diff --git a/tests/allowed_addresses.go b/tests/allowed_addresses.go index 4e240f36..f662878c 100644 --- a/tests/allowed_addresses.go +++ b/tests/allowed_addresses.go @@ -181,7 +181,8 @@ func AllowedAddresses(network interfaces.LocalNetwork) { // Wait for relayer to start up log.Info("Waiting for the relayer to start up") - startupCtx, _ := context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel := context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) // Allowed by Relayer 1 @@ -210,7 +211,8 @@ func AllowedAddresses(network interfaces.LocalNetwork) { // Wait for relayer to start up log.Info("Waiting for the relayer to start up") - startupCtx, _ = context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel = context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) // Disallowed by Relayer 2 @@ -255,7 +257,8 @@ func AllowedAddresses(network interfaces.LocalNetwork) { // Wait for relayer to start up log.Info("Waiting for the relayer to start up") - startupCtx, _ = context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel = context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) // Disallowed by Relayer 3 @@ -299,7 +302,8 @@ func AllowedAddresses(network interfaces.LocalNetwork) { defer relayerCleanup() // Wait for relayer to start up - startupCtx, _ = context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel = context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) // Disallowed by Relayer 4 diff --git a/tests/basic_relay.go b/tests/basic_relay.go index 4670bd7f..ed3aa2f2 100644 --- a/tests/basic_relay.go +++ b/tests/basic_relay.go @@ -71,7 +71,8 @@ func BasicRelay(network interfaces.LocalNetwork) { defer relayerCleanup() // Wait for relayer to start up - startupCtx, _ := context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel := context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) log.Info("Sending transaction from Subnet A to Subnet B") @@ -156,6 +157,8 @@ func BasicRelay(network interfaces.LocalNetwork) { // Wait for relayer to start up log.Info("Waiting for the relayer to start up") + startupCtx, startupCancel = context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) // We should not receive a new block on subnet B, since the relayer should have diff --git a/tests/batch_relay.go b/tests/batch_relay.go index 9e346b9d..b1960a5c 100644 --- a/tests/batch_relay.go +++ b/tests/batch_relay.go @@ -76,7 +76,8 @@ func BatchRelay(network interfaces.LocalNetwork) { // Wait for relayer to start up log.Info("Waiting for the relayer to start up") - startupCtx, _ := context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel := context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) // diff --git a/tests/manual_message.go b/tests/manual_message.go index 83e8d9c6..b254ad99 100644 --- a/tests/manual_message.go +++ b/tests/manual_message.go @@ -118,7 +118,8 @@ func ManualMessage(network interfaces.LocalNetwork) { // Wait for relayer to startup. log.Info("Waiting for the relayer to start up") - startupCtx, _ := context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel := context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) reqBody := api.ManualWarpMessageRequest{ diff --git a/tests/relay_message_api.go b/tests/relay_message_api.go index cc592203..2c18ed81 100644 --- a/tests/relay_message_api.go +++ b/tests/relay_message_api.go @@ -75,7 +75,8 @@ func RelayMessageAPI(network interfaces.LocalNetwork) { // Wait for relayer to start up log.Info("Waiting for the relayer to start up") - startupCtx, _ := context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel := context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) reqBody := api.RelayMessageRequest{ diff --git a/tests/signature_aggregator_api.go b/tests/signature_aggregator_api.go index a611adcd..c0a2e393 100644 --- a/tests/signature_aggregator_api.go +++ b/tests/signature_aggregator_api.go @@ -61,7 +61,8 @@ func SignatureAggregatorAPI(network interfaces.LocalNetwork) { // Wait for signature-aggregator to start up log.Info("Waiting for the relayer to start up") - startupCtx, _ := context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel := context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) // End setup step diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 42868277..70974a4b 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -442,7 +442,8 @@ func TriggerProcessMissedBlocks( defer relayerCleanup() // Wait for relayer to start up - startupCtx, _ := context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel := context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() WaitForChannelClose(startupCtx, readyChan) log.Info("Waiting for a new block confirmation on the destination") diff --git a/tests/warp_api.go b/tests/warp_api.go index 96e39fbb..9a374fc2 100644 --- a/tests/warp_api.go +++ b/tests/warp_api.go @@ -78,7 +78,8 @@ func WarpAPIRelay(network interfaces.LocalNetwork) { // Wait for relayer to start up log.Info("Waiting for the relayer to start up") - startupCtx, _ := context.WithTimeout(ctx, 15*time.Second) + startupCtx, startupCancel := context.WithTimeout(ctx, 15*time.Second) + defer startupCancel() testUtils.WaitForChannelClose(startupCtx, readyChan) log.Info("Sending transaction from Subnet A to Subnet B")