@@ -19,7 +19,7 @@ import (
1919 "github.com/ethereum/go-ethereum/core/types"
2020 "github.com/ethereum/go-ethereum/crypto"
2121 "github.com/ethereum/go-ethereum/eth/ethconfig"
22- "github.com/onsi/gomega "
22+ "github.com/stretchr/testify/assert "
2323 "github.com/stretchr/testify/require"
2424
2525 "github.com/smartcontractkit/freeport"
@@ -603,12 +603,12 @@ func ClientTestRequests(t *testing.T, owner *bind.TransactOpts, b evmtypes.Backe
603603 // send requests
604604 requestSources := make ([][]byte , len (clientContracts ))
605605 rnd := rand .New (rand .NewSource (666 ))
606- for i , client := range clientContracts {
606+ for i , cc := range clientContracts {
607607 requestSources [i ] = make ([]byte , requestLenBytes )
608608 for j := range requestLenBytes {
609609 requestSources [i ][j ] = byte (rnd .Uint32 () % 256 )
610610 }
611- _ , err := client .Contract .SendRequest (
611+ _ , err := cc .Contract .SendRequest (
612612 owner ,
613613 hex .EncodeToString (requestSources [i ]),
614614 expectedSecrets ,
@@ -617,22 +617,21 @@ func ClientTestRequests(t *testing.T, owner *bind.TransactOpts, b evmtypes.Backe
617617 donId ,
618618 )
619619 require .NoError (t , err )
620+ client .FinalizeLatest (t , b )
620621 }
621- client .FinalizeLatest (t , b )
622-
623622 // validate that all client contracts got correct responses to their requests
624623 var wg sync.WaitGroup
625624 for i := range clientContracts {
626625 ic := i
627- wg .Add (1 )
628- go func () {
629- defer wg .Done ()
630- gomega .NewGomegaWithT (t ).Eventually (func () [32 ]byte {
626+ wg .Go (func () {
627+ assert .Eventually (t , func () bool {
631628 answer , err := clientContracts [ic ].Contract .SLastResponse (nil )
632- require .NoError (t , err )
633- return answer
634- }, timeout , 1 * time .Second ).Should (gomega .Equal (GetExpectedResponse (requestSources [ic ])))
635- }()
629+ if err != nil {
630+ return false
631+ }
632+ return answer == GetExpectedResponse (requestSources [ic ])
633+ }, timeout , 1 * time .Second , "unexpected response for client contract at index %d" , ic )
634+ })
636635 }
637636 wg .Wait ()
638637}
0 commit comments