Skip to content

Commit 7ba0b94

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

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

tests/utils/command.go

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

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

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-
7779
func RegisterNodeRun() {
7880
// Keep track of the AvalancheGo external bash script, it is null for most
7981
// processes except the first process that starts AvalancheGo
8082
var startCmd *cmd.Cmd
8183

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.
84+
// Our test suite runs in separate processes, ginkgo has
85+
// SynchronizedBeforeSuite() which runs once, and its return value is passed
86+
// over to each worker.
8587
//
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.
88+
// Here an AvalancheGo node instance is started, and subnets are created for
89+
// each test case. Each test case has its own subnet, therefore all tests
90+
// can run in parallel without any issue.
8991
//
9092
// This function also compiles all the solidity contracts
9193
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)