Skip to content

Commit

Permalink
wait for first block at testutil network
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Jun 13, 2024
1 parent 366109b commit 4d9cc76
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion testutil/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ func New(t *testing.T, cfg Config) *Network {
WithCodec(cfg.Codec).
WithLegacyAmino(cfg.LegacyAmino).
WithTxConfig(cfg.TxConfig).
WithAccountRetriever(cfg.AccountRetriever)
WithAccountRetriever(cfg.AccountRetriever).
WithNodeURI(tmCfg.RPC.ListenAddress)

network.Validators[i] = &Validator{
AppConfig: appCfg,
Expand All @@ -380,6 +381,14 @@ func New(t *testing.T, cfg Config) *Network {
}
t.Log("started test network")

require.NoError(t, network.WaitForNextBlock())
height, err := network.LatestHeight()
if err != nil {
return nil

Check warning on line 387 in testutil/network/network.go

View check run for this annotation

Codecov / codecov/patch

testutil/network/network.go#L387

Added line #L387 was not covered by tests
}

t.Log("started test network at height:", height)

// Ensure we cleanup incase any test was abruptly halted (e.g. SIGINT) as any
// defer in a test would not be called.
server.TrapSignal(network.Cleanup)
Expand Down

0 comments on commit 4d9cc76

Please sign in to comment.