Skip to content

Commit 47d4571

Browse files
authored
app/eth1wrap_test: fix flaky tests (#3787)
Fix wait for client to initialize in tests using `defer close(clientCreatedCh)` instead of just `close(clientCreatedCh)` to ensure channel is only closed after returning the client. category: bug ticket: none
1 parent 40e4497 commit 47d4571

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/eth1wrap/eth1wrap_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func TestVerifySmartContractBasedSignature(t *testing.T) {
226226
client := eth1wrap.NewEthClientRunner(
227227
"",
228228
func(ctx context.Context, rawurl string) (eth1wrap.EthClient, error) {
229-
clientCreatedCh <- struct{}{}
229+
defer close(clientCreatedCh)
230230
return mockEth1Client, nil
231231
},
232232
func(contractAddress string, eth1Client eth1wrap.EthClient) (eth1wrap.Erc1271, error) {
@@ -271,7 +271,7 @@ func TestVerifySmartContractBasedSignature(t *testing.T) {
271271
client := eth1wrap.NewEthClientRunner(
272272
"",
273273
func(ctx context.Context, rawurl string) (eth1wrap.EthClient, error) {
274-
close(clientCreatedCh)
274+
defer close(clientCreatedCh)
275275
return mockEth1Client, nil
276276
},
277277
func(contractAddress string, eth1Client eth1wrap.EthClient) (eth1wrap.Erc1271, error) {

0 commit comments

Comments
 (0)