Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2419: Fix flaky stake pools integration test r=Anviking a=rvl ### Issue Number Flaky test #2415 ### Overview This test failure seemed to be happening quite a lot the other day. Now I can't reproduce it. I am pretty sure the error is from somewhere in `stakeDistribution` which is used by `listPools`. My guess of the cause is that rollback causes ledger queries to temporarily fail. (confirmed: ADP-647) The error was never logged, and the exception message was not part of the HTTP 503 response. 1. [x] Fix some minor test environment issues. 2. [x] If a ledger query fails, make sure that the exception is logged. 3. [x] Correct the return type of `listPools` and functions that it calls. 4. [x] Reproduce error with logs, diagnose problem. Problem 1: unreproduceable. Problem 2: epoch rollover between tx submission and rewards balance check. 5. [x] Fix the ~code and/or~ test case. 6. [x] Add utility functions for transforming BracketLog traces into time deltas and logging timings. 7. [x] Add back logging of how long ledger queries take. ### Comments - I haven't reproduced the error, but it's worth merging these fixes anyway. - The new error, which seems to happen reliably on the same test case, is this: ``` [1 2021-01-05 17:33:29] Failures: [1 2021-01-05 17:33:29] [1 2021-01-05 17:33:29] src/Test/Integration/Scenario/API/Shelley/StakePools.hs:324:26: [1 2021-01-05 17:33:29] 1) API Specifications, SHELLEY_STAKE_POOLS, STAKE_POOLS_JOIN_01rewards - Can join a pool, earn rewards and collect them [1 2021-01-05 17:33:29] While verifying (Status {statusCode = 200, statusMessage = "OK"},Right (ApiWallet {id = ApiT {getApiT = WalletId {getWalletId = c83c7e41054d4f96238c00e1a8abf75c7a93f485}}, addressPoolGap = ApiT {getApiT = AddressPoolGap {getAddressPoolGap = 20}}, balance = ApiT {getApiT = WalletBalance {available = Quantity {getQuantity = 999998581353}, total = Quantity {getQuantity = 1000007589123}, reward = Quantity {getQuantity = 9007770}}}, delegation = ApiWalletDelegation {active = ApiWalletDelegationNext {status = Delegating, target = Just (ApiT {getApiT = PoolId {getPoolId = "\187\DC1L\179}u\250\ENQ&\ETX(\194\&5\163\218\226\149\163=\v\166t\165\235\RS>V\142"}}), changesAt = Nothing}, next = []}, name = ApiT {getApiT = WalletName {getWalletName = "Faucet Wallet"}}, passphrase = Just (ApiWalletPassphraseInfo {lastUpdatedAt = 2021-01-05 09:22:50.035321314 UTC}), state = ApiT {getApiT = Ready}, tip = ApiBlockReference {absoluteSlotNumber = ApiT {getApiT = SlotNo 5056}, slotId = ApiSlotId {epochNumber = ApiT {getApiT = EpochNo {unEpochNo = 101}}, slotNumber = ApiT {getApiT = SlotInEpoch {unSlotInEpoch = 6}}}, time = 2021-01-05 09:25:03.2 UTC, block = ApiBlockInfo {height = Quantity {getQuantity = 2533}}}})) [1 2021-01-05 17:33:29] Waited longer than 90s to resolve action: "Wallet has consumed rewards". [1 2021-01-05 17:33:29] expected: Quantity {getQuantity = 0} [1 2021-01-05 17:33:29] but got: Quantity {getQuantity = 9007770} [1 2021-01-05 17:33:29] [1 2021-01-05 17:33:29] To rerun use: --match "/API Specifications/SHELLEY_STAKE_POOLS/STAKE_POOLS_JOIN_01rewards - Can join a pool, earn rewards and collect them/" [1 2021-01-05 17:33:29] [1 2021-01-05 17:33:29] Randomized with seed 1938796546 [1 2021-01-05 17:33:29] [1 2021-01-05 17:33:29] Finished in 1514.5249 seconds [1 2021-01-05 17:33:29] 711 examples, 1 failure, 9 pending [1 2021-01-05 17:33:29] NO_CLEANUP of temporary directory /run/user/1000/test-06a07e3d6c739d45 real 25m15.583s user 27m19.699s sys 2m15.754s ``` The cause of this failure (according to the logs) is epoch rollover happening just after the rewards withdrawal transaction is submitted. New rewards accrue before the test case can check that previous rewards were withdrawn. Inherently flaky. Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
- Loading branch information
Showing
23 changed files
with
363 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,7 @@ library | |
, text-class | ||
, time | ||
, tls | ||
, tracer-transformers | ||
, transformers | ||
, typed-protocols | ||
, unliftio | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.