Skip to content

Commit

Permalink
call cancelfuncs
Browse files Browse the repository at this point in the history
  • Loading branch information
iansuvak committed Aug 21, 2024
1 parent 245cdd6 commit 91e6028
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 11 deletions.
12 changes: 8 additions & 4 deletions tests/allowed_addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion tests/basic_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/batch_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

//
Expand Down
3 changes: 2 additions & 1 deletion tests/manual_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 2 additions & 1 deletion tests/relay_message_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 2 additions & 1 deletion tests/signature_aggregator_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion tests/warp_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 91e6028

Please sign in to comment.