@@ -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
2136func init () {
22- getSubnet = runner .RegisterFiveNodeSubnetRun ()
37+ // Configures flags used to configure tmpnet
38+ flagVars = e2e .RegisterFlags ()
2339}
2440
2541func TestE2E (t * testing.T ) {
@@ -28,25 +44,43 @@ func TestE2E(t *testing.T) {
2844}
2945
3046var _ = 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 ("\n Combined output:\n \n %s\n " , string (out ))
50- gomega . Expect (err ). Should ( gomega . BeNil () )
84+ require . NoError (err )
5185 })
5286})
0 commit comments