From b3533f63cf7be2df1bd3b5279d7914a72f1e4de9 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:38:14 -0800 Subject: [PATCH] Throttle integration test fixes (#696) * adjust timeout * change state assertion --- tests/integration/actions.go | 4 +++- tests/integration/steps_downtime.go | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/integration/actions.go b/tests/integration/actions.go index eef6fb59fb..5014581485 100644 --- a/tests/integration/actions.go +++ b/tests/integration/actions.go @@ -1227,7 +1227,7 @@ func (tr TestRun) waitForSlashThrottleDequeue( } if globalQueueSize == chainQueueSize && globalQueueSize == action.nextQueueSize { - return + break } if time.Now().After(timeout) { @@ -1236,6 +1236,8 @@ func (tr TestRun) waitForSlashThrottleDequeue( time.Sleep(500 * time.Millisecond) } + // Sleep 20 seconds to pass a block, allowing the jailing to be incorporated into voting power + time.Sleep(20 * time.Second) } func uintPointer(i uint) *uint { diff --git a/tests/integration/steps_downtime.go b/tests/integration/steps_downtime.go index d5baf9f88a..2d63ec5dd1 100644 --- a/tests/integration/steps_downtime.go +++ b/tests/integration/steps_downtime.go @@ -281,15 +281,17 @@ func stepsThrottledDowntime(consumerName string) []Step { chain: chainID(consumerName), currentQueueSize: 1, nextQueueSize: 0, - timeout: time.Minute, // panic after reaching timeout + // Slash meter replenish fraction is set to 10%, replenish period is 20 seconds, see config.go + // Meter is initially at 10%, decremented to -23% from bob being jailed. It'll then take three replenishments + // for meter to become positive again. 3*20 = 60 seconds + buffer = 80 seconds + timeout: 80 * time.Second, }, state: State{ - // no changes in state should occur chainID("provi"): ChainState{ ValPowers: &map[validatorID]uint{ validatorID("alice"): 511, validatorID("bob"): 0, - validatorID("carol"): 500, + validatorID("carol"): 0, // Carol is jailed upon packet being handled on provider }, GlobalSlashQueueSize: uintPointer(0), // slash packets dequeued ConsumerChainQueueSizes: &map[chainID]uint{