From b0fdadb6a54e1649a36f458e549b3ad21ffaa05d Mon Sep 17 00:00:00 2001 From: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> Date: Thu, 3 Aug 2023 10:59:57 +0200 Subject: [PATCH] chore: Fix and enable CometMock in e2e tests (#1184) * 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 --- tests/e2e/actions.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index faad8cb6f8..9f0b969263 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -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 { @@ -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. @@ -1985,6 +1987,7 @@ func (tr *TestRun) WaitTime(duration time.Duration) { continue } tr.AdvanceTimeForChain(chain, duration) + tr.waitBlocks(chain, 1, 2*time.Second) } } }