From ecd045eb49c1e0f5819590705acb610a8e8fcf4a Mon Sep 17 00:00:00 2001 From: Sri Kidambi <1702865+kidambisrinivas@users.noreply.github.com> Date: Mon, 30 Sep 2024 20:00:14 +0100 Subject: [PATCH] Wait for all goroutines to exit in test --- .../relay/evm/capabilities/log_event_trigger_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/services/relay/evm/capabilities/log_event_trigger_test.go b/core/services/relay/evm/capabilities/log_event_trigger_test.go index 1638c54782c..f2104529b7f 100644 --- a/core/services/relay/evm/capabilities/log_event_trigger_test.go +++ b/core/services/relay/evm/capabilities/log_event_trigger_test.go @@ -5,6 +5,7 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -61,10 +62,13 @@ func TestLogEventTriggerEVMHappyPath(t *testing.T) { expectedLogVal := int64(10) // Send a blockchain transaction that emits logs + done := make(chan struct{}) + t.Cleanup(func() { <-done }) go func() { + defer close(done) _, err = th.LogEmitterContract.EmitLog1(th.BackendTH.ContractsOwner, []*big.Int{big.NewInt(expectedLogVal)}) - require.NoError(t, err) + assert.NoError(t, err) th.BackendTH.Backend.Commit() th.BackendTH.Backend.Commit() th.BackendTH.Backend.Commit()