Skip to content

Commit dcf3c7f

Browse files
committed
Improve tests
Improve tests based on feedback from #712
1 parent 484ce17 commit dcf3c7f

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

tests/utils/command.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ import (
1919
"github.com/onsi/gomega"
2020
)
2121

22+
// At boot time subnets are created, one for each test suite. This global
23+
// variable has all the subnets IDs that can be used.
24+
//
25+
// One process creates the AvalancheGo node and all the subnets, and these
26+
// subnets IDs are passed to all other processes and stored in this global
27+
// variable
28+
var BlockchainIDs map[string]string
29+
30+
// Timeout to boot the AvalancheGo node
31+
var bootAvalancheNodeTimeout = 5 * time.Minute
32+
33+
// Timeout for the health API to check the AvalancheGo is ready
34+
var healthCheckTimeout = 5 * time.Second
35+
2236
// RunCommand starts the command [bin] with the given [args] and returns the command to the caller
2337
// TODO cmd package mentions we can do this more efficiently with cmd.NewCmdOptions rather than looping
2438
// and calling Status().
@@ -60,32 +74,18 @@ func RegisterPingTest() {
6074
})
6175
}
6276

63-
// At boot time subnets are created, one for each test suite. This global
64-
// variable has all the subnets IDs that can be used.
65-
//
66-
// One process creates the AvalancheGo node and all the subnets, and these
67-
// subnets IDs are passed to all other processes and stored in this global
68-
// variable
69-
var BlockchainIDs map[string]string
70-
71-
// Timeout to boot the AvalancheGo node
72-
var bootAvalancheNodeTimeout = 5 * time.Minute
73-
74-
// Timeout for the health API to check the AvalancheGo is ready
75-
var healthCheckTimeout = 5 * time.Second
76-
7777
func RegisterNodeRun() {
7878
// Keep track of the AvalancheGo external bash script, it is null for most
7979
// processes except the first process that starts AvalancheGo
8080
var startCmd *cmd.Cmd
8181

82-
// Our test suite runs in a separated processes, ginkgo hasI
83-
// SynchronizedBeforeSuite() which is promised to run once, and its output is
84-
// passed over to each worker.
82+
// Our test suite runs in separate processes, ginkgo has
83+
// SynchronizedBeforeSuite() which runs once, and its return value is passed
84+
// over to each worker.
8585
//
86-
// In here an AvalancheGo node instance is started, and subnets are created for
87-
// each test case. Each test case has its own subnet, therefore all tests can
88-
// run in parallel without any issue.
86+
// Here an AvalancheGo node instance is started, and subnets are created for
87+
// each test case. Each test case has its own subnet, therefore all tests
88+
// can run in parallel without any issue.
8989
//
9090
// This function also compiles all the solidity contracts
9191
var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {

tests/utils/subnet.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,12 @@ func GetDefaultChainURI(blockchainID string) string {
111111
// 3. npx is available in the ./contracts directory
112112
func RunDefaultHardhatTests(ctx context.Context, blockchainID string, test string) {
113113
chainURI := GetDefaultChainURI(blockchainID)
114-
log.Info("Executing HardHat tests on a new blockchain", "blockchainID", blockchainID, "test", test)
115-
log.Info("Using subnet", "ChainURI", chainURI)
114+
log.Info(
115+
"Executing HardHat tests on a new blockchain",
116+
"blockchainID", blockchainID,
117+
"test", test,
118+
"ChainURI", chainURI,
119+
)
116120

117121
cmdPath := "./contracts"
118122
// test path is relative to the cmd path

0 commit comments

Comments
 (0)