Skip to content

Commit

Permalink
add cleanup on adjusting the allowance parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
poktblade committed Apr 7, 2023
1 parent 727cf3a commit eef50cf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion x/pocketcore/keeper/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,20 @@ func TestKeeper_HandleRelay(t *testing.T) {
ctx, keeper, kvkeys, clientPrivateKey, appPrivateKey, nodePubKey, chain :=
setupHandleRelayTest(t)

// Eliminate the impact of ClientBlockSyncAllowance
// Store the original allowances to clean up at the end of this test
originalClientBlockSyncAllowance := types.GlobalPocketConfig.ClientBlockSyncAllowance
originalClientSessionSyncAllowance := types.GlobalPocketConfig.ClientSessionSyncAllowance

// Eliminate the impact of ClientBlockSyncAllowance to avoid any relay meta validation errors (OutOfSyncError)
types.GlobalPocketConfig.ClientBlockSyncAllowance = 10000

nodeBlockHeight := ctx.BlockHeight()
blocksPerSesssion := keeper.BlocksPerSession(ctx)
latestSessionHeight := keeper.GetLatestSessionBlockHeight(ctx)

t.Cleanup(func() {
types.GlobalPocketConfig.ClientBlockSyncAllowance = originalClientBlockSyncAllowance
types.GlobalPocketConfig.ClientSessionSyncAllowance = originalClientSessionSyncAllowance
gock.Off() // Flush pending mocks after test execution
})

Expand Down

0 comments on commit eef50cf

Please sign in to comment.