Skip to content

Commit

Permalink
Use error group
Browse files Browse the repository at this point in the history
  • Loading branch information
carte7000 committed Jan 10, 2025
1 parent 0a953e5 commit ebb18e0
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions integration-tests/smoke/ccip/ccip_rmn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/rs/zerolog"
"github.com/stretchr/testify/require"
"golang.org/x/sync/errgroup"

"github.com/smartcontractkit/chainlink-protos/job-distributor/v1/node"
"github.com/smartcontractkit/chainlink-testing-framework/lib/utils/osutil"
Expand Down Expand Up @@ -652,6 +653,7 @@ func (tc rmnTestCase) callContractsToCurseAndRevokeCurse(ctx context.Context, t
if !ok {
continue // nothing to curse on this chain
}
eg := errgroup.Group{}

for subjectDescription, revokeAfter := range cursedSubjects {
curseActions := make([]changeset.CurseAction, 0)
Expand All @@ -668,20 +670,29 @@ func (tc rmnTestCase) callContractsToCurseAndRevokeCurse(ctx context.Context, t
})
t.Error(err)

go func() {
eg.Go(func() error {
<-time.NewTimer(revokeAfter).C
t.Logf("revoking curse on subject %d (%d)", subjectDescription, subjectDescription)

_, err := changeset.NewRMNUncurseChangeset(envWithRMN.Env, changeset.RMNCurseConfig{
CurseActions: curseActions,
Reason: "test uncurse",
})
require.NoError(t, err)
if err != nil {
return err
}

cs, err := chState.RMNRemote.GetCursedSubjects(&bind.CallOpts{Context: ctx})
require.NoError(t, err)

if err != nil {
return err
}

t.Logf("Cursed subjects after revoking: %v", cs)
}()
return nil
})
}
require.NoError(t, eg.Wait())

cs, err := chState.RMNRemote.GetCursedSubjects(&bind.CallOpts{Context: ctx})
require.NoError(t, err)
Expand Down

0 comments on commit ebb18e0

Please sign in to comment.