Skip to content

Commit 9633252

Browse files
Add sync.WaitGroup to ensure all validator votes complete in SubmitAndVoteGovProposal (#2324)
* Add sync.WaitGroup to ensure all validator votes complete in SubmitAndVoteGovProposal * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent eeaba31 commit 9633252

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/system/cli.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"slices"
1111
"strconv"
1212
"strings"
13+
"sync"
1314
"testing"
1415
"time"
1516

@@ -414,13 +415,18 @@ func (c WasmdCli) SubmitAndVoteGovProposal(proposalJson string, args ...string)
414415
proposals := gjson.Get(raw, "proposals.#.id").Array()
415416
require.NotEmpty(c.t, proposals, raw)
416417
ourProposalID := proposals[len(proposals)-1].String() // last is ours
418+
419+
var wg sync.WaitGroup
420+
wg.Add(c.nodesCount)
417421
for i := 0; i < c.nodesCount; i++ {
418422
go func(i int) { // do parallel
423+
defer wg.Done()
419424
c.t.Logf("Voting: validator %d\n", i)
420425
rsp = c.CustomCommand("tx", "gov", "vote", ourProposalID, "yes", "--from", c.GetKeyAddr(fmt.Sprintf("node%d", i)))
421426
RequireTxSuccess(c.t, rsp)
422427
}(i)
423428
}
429+
wg.Wait()
424430
return ourProposalID
425431
}
426432

0 commit comments

Comments
 (0)