Skip to content

Commit

Permalink
Throttle integration test fixes (#696)
Browse files Browse the repository at this point in the history
* adjust timeout

* change state assertion
  • Loading branch information
shaspitz authored Feb 1, 2023
1 parent b89c46e commit b3533f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion tests/integration/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ func (tr TestRun) waitForSlashThrottleDequeue(
}

if globalQueueSize == chainQueueSize && globalQueueSize == action.nextQueueSize {
return
break
}

if time.Now().After(timeout) {
Expand All @@ -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 {
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/steps_downtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit b3533f6

Please sign in to comment.