Skip to content

Commit

Permalink
chore: Fix and enable CometMock in e2e tests (#1184)
Browse files Browse the repository at this point in the history
* Add make time.sleep WaitTime and wait block after waiting time

* Uncomment verbose error check

* Fix spacing

* Make format

* Add make target for CometMock e2e tests

* Add CometMock job to automated tests
  • Loading branch information
p-offtermatt authored and MSalopek committed Aug 9, 2023
1 parent 20dba34 commit b0fdadb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ func (tr *TestRun) voteGovProposal(
wg.Wait()
// wait for inclusion in a block -> '--broadcast-mode block' is deprecated
tr.waitBlocks(action.chain, 1, 10*time.Second)
time.Sleep(time.Duration(tr.chainConfigs[action.chain].votingWaitTime) * time.Second)
tr.WaitTime(time.Duration(tr.chainConfigs[action.chain].votingWaitTime) * time.Second)
}

type startConsumerChainAction struct {
Expand Down Expand Up @@ -1972,6 +1972,8 @@ func (tr TestRun) GetPathNameForGorelayer(chainA, chainB chainID) string {
}

// WaitTime waits for the given duration.
// To make sure that the new timestamp is visible on-chain, it also waits until at least one block has been
// produced on each chain after waiting.
// The CometMock version of this takes a pointer to the TestRun as it needs to manipulate
// information in the testrun that stores how much each chain has waited, to keep times in sync.
// Be careful that all functions calling WaitTime should therefore also take a pointer to the TestRun.
Expand All @@ -1985,6 +1987,7 @@ func (tr *TestRun) WaitTime(duration time.Duration) {
continue
}
tr.AdvanceTimeForChain(chain, duration)
tr.waitBlocks(chain, 1, 2*time.Second)
}
}
}
Expand Down

0 comments on commit b0fdadb

Please sign in to comment.