Skip to content

Commit 4cd0cdf

Browse files
committed
e2e: Switch load test to use the tmpnet fixture
1 parent fbcdc9e commit 4cd0cdf

File tree

3 files changed

+60
-23
lines changed

3 files changed

+60
-23
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,20 @@ jobs:
9090
- name: Run E2E Tests
9191
shell: bash
9292
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego DATA_DIR=/tmp/e2e-test/data ./scripts/run_ginkgo.sh
93+
- name: Upload tmpnet network dir for load testing
94+
uses: actions/upload-artifact@v3
95+
if: always()
96+
with:
97+
name: load-tmpnet-data
98+
path: ~/.tmpnet/networks/1000
99+
if-no-files-found: error
93100
- name: Run Warp E2E Tests
94101
shell: bash
95102
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/run_ginkgo_warp.sh
96-
- name: Upload e2e Artifact
97-
if: always()
98-
uses: actions/upload-artifact@v3
99-
with:
100-
name: subnet-evm-e2e-logs
101-
path: /tmp/network-runner-root-data*/
102-
retention-days: 5
103103
- name: Upload tmpnet network dir for warp testing
104104
uses: actions/upload-artifact@v3
105105
if: always()
106106
with:
107107
name: warp-tmpnet-data
108-
path: ~/.tmpnet/networks/1000
108+
path: ~/.tmpnet/networks/1001
109109
if-no-files-found: error

scripts/run_ginkgo.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ go install -v github.com/onsi/ginkgo/v2/ginkgo@${GINKGO_VERSION}
2121

2222
TEST_SOURCE_ROOT=$(pwd)
2323

24-
ACK_GINKGO_RC=true ginkgo build ./tests/load
25-
2624
# By default, it runs all e2e test cases!
2725
# Use "--ginkgo.skip" to skip tests.
2826
# Use "--ginkgo.focus" to select tests.
2927
TEST_SOURCE_ROOT="$TEST_SOURCE_ROOT" ginkgo run -procs=5 tests/precompile \
3028
--ginkgo.vv \
3129
--ginkgo.label-filter=${GINKGO_LABEL_FILTER:-""}
3230

33-
./tests/load/load.test \
34-
--ginkgo.vv \
35-
--ginkgo.label-filter=${GINKGO_LABEL_FILTER:-""}
31+
EXTRA_ARGS=
32+
AVALANCHEGO_BUILD_PATH="${AVALANCHEGO_BUILD_PATH:-}"
33+
if [[ -n "${AVALANCHEGO_BUILD_PATH}" ]]; then
34+
EXTRA_ARGS="-- --avalanchego-path=${AVALANCHEGO_BUILD_PATH}/avalanchego --plugin-dir=${AVALANCHEGO_BUILD_PATH}/plugins"
35+
echo "Running with extra args: ${EXTRA_ARGS}"
36+
fi
37+
38+
ginkgo -vv --label-filter=${GINKGO_LABEL_FILTER:-""} ./tests/load ${EXTRA_ARGS}

tests/load/load_test.go

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,35 @@ import (
77
"fmt"
88
"os"
99
"os/exec"
10+
"path/filepath"
1011
"strings"
1112
"testing"
1213

13-
"github.com/ava-labs/subnet-evm/tests/utils/runner"
14-
"github.com/ethereum/go-ethereum/log"
1514
ginkgo "github.com/onsi/ginkgo/v2"
15+
1616
"github.com/onsi/gomega"
17+
18+
"github.com/stretchr/testify/require"
19+
20+
"github.com/ethereum/go-ethereum/log"
21+
22+
"github.com/ava-labs/avalanchego/tests/fixture/e2e"
23+
"github.com/ava-labs/avalanchego/tests/fixture/tmpnet"
24+
25+
"github.com/ava-labs/subnet-evm/tests"
26+
"github.com/ava-labs/subnet-evm/tests/utils"
1727
)
1828

19-
var getSubnet func() *runner.Subnet
29+
const subnetAName = "load-subnet-a"
30+
31+
var (
32+
flagVars *e2e.FlagVars
33+
repoRootPath = tests.GetRepoRootPath("tests/load")
34+
)
2035

2136
func init() {
22-
getSubnet = runner.RegisterFiveNodeSubnetRun()
37+
// Configures flags used to configure tmpnet
38+
flagVars = e2e.RegisterFlags()
2339
}
2440

2541
func TestE2E(t *testing.T) {
@@ -28,25 +44,43 @@ func TestE2E(t *testing.T) {
2844
}
2945

3046
var _ = ginkgo.Describe("[Load Simulator]", ginkgo.Ordered, func() {
47+
require := require.New(ginkgo.GinkgoT())
48+
49+
var env *e2e.TestEnvironment
50+
51+
ginkgo.BeforeAll(func() {
52+
genesisPath := filepath.Join(repoRootPath, "tests/load/genesis/genesis.json")
53+
env = e2e.NewTestEnvironment(
54+
flagVars,
55+
utils.NewTmpnetNetwork(
56+
utils.NewTmpnetSubnet(subnetAName, genesisPath),
57+
),
58+
)
59+
})
60+
3161
ginkgo.It("basic subnet load test", ginkgo.Label("load"), func() {
32-
subnetDetails := getSubnet()
33-
blockchainID := subnetDetails.BlockchainID
62+
network := env.GetNetwork()
63+
64+
subnet := network.GetSubnet(subnetAName)
65+
require.NotNil(subnet)
66+
blockchainID := subnet.Chains[0].ChainID
3467

35-
nodeURIs := subnetDetails.ValidatorURIs
68+
nodeURIs := tmpnet.GetNodeURIs(network.Nodes)
3669
rpcEndpoints := make([]string, 0, len(nodeURIs))
3770
for _, uri := range nodeURIs {
38-
rpcEndpoints = append(rpcEndpoints, fmt.Sprintf("%s/ext/bc/%s/rpc", uri, blockchainID))
71+
rpcEndpoints = append(rpcEndpoints, fmt.Sprintf("%s/ext/bc/%s/rpc", uri.URI, blockchainID))
3972
}
4073
commaSeparatedRPCEndpoints := strings.Join(rpcEndpoints, ",")
4174
err := os.Setenv("RPC_ENDPOINTS", commaSeparatedRPCEndpoints)
42-
gomega.Expect(err).Should(gomega.BeNil())
75+
require.NoError(err)
4376

4477
log.Info("Running load simulator...", "rpcEndpoints", commaSeparatedRPCEndpoints)
4578
cmd := exec.Command("./scripts/run_simulator.sh")
79+
cmd.Dir = repoRootPath
4680
log.Info("Running load simulator script", "cmd", cmd.String())
4781

4882
out, err := cmd.CombinedOutput()
4983
fmt.Printf("\nCombined output:\n\n%s\n", string(out))
50-
gomega.Expect(err).Should(gomega.BeNil())
84+
require.NoError(err)
5185
})
5286
})

0 commit comments

Comments
 (0)