Skip to content

Commit

Permalink
Make TRANS_NEW_JOIN_01a less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
HeinrichApfelmus committed Jun 13, 2023
1 parent 68ea3ad commit 3bb2e47
Showing 1 changed file with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2644,6 +2644,10 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" $ do
dest <- emptyWallet ctx
let depositAmt = Quantity 1_000_000

-- Note: In the local cluster,
-- one of the pools retires soon after the blockchain was started.
-- If you run this integration too early,
-- you might pick up a pool that retires soon after.
pool1:pool2:_ <- map (view $ _Unwrapped . #id) . snd <$> unsafeRequest @[ApiT StakePool]
ctx (Link.listStakePools arbitraryStake) Empty

Expand Down Expand Up @@ -2891,28 +2895,29 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" $ do
, expectResponseCode HTTP.status202
]

let txid3 = getFromResponse (#id) submittedTx4
let queryTx3 = Link.getTransaction @'Shelley src (ApiTxId txid3)
rGetTx3 <- request @(ApiTransaction n) ctx queryTx3 Default Empty
verify rGetTx3
[ expectResponseCode HTTP.status200
, expectField #depositTaken (`shouldBe` Quantity 0)
, expectField #depositReturned (`shouldBe` depositAmt)
]

eventually "Wallet is not delegating" $ do
request @ApiWallet ctx (Link.getWallet @'Shelley src) Default Empty
>>= flip verify
[ expectField #delegation (`shouldBe` notDelegating [])
]
-- Wait for the transaction to be accepted into the ledger
let txidQuit = getFromResponse (#id) submittedTx4
queryTxQuit = Link.getTransaction @'Shelley src (ApiTxId txidQuit)
eventually "Wait for ledger to accept Quit transaction" $ do
rGetTxQuit <- request @(ApiTransaction n) ctx queryTxQuit Default Empty
verify rGetTxQuit
[ expectResponseCode HTTP.status200
, expectField #insertedAt (`shouldSatisfy` isJust)
]

-- transaction history shows deposit returned
rGetTx4 <- request @(ApiTransaction n) ctx queryTx3 Default Empty
verify rGetTx4
-- Wallet will stop delegating
rGetTxQuit' <- request @(ApiTransaction n) ctx queryTxQuit Default Empty
verify rGetTxQuit'
[ expectResponseCode HTTP.status200
, expectField #depositTaken (`shouldBe` Quantity 0)
, expectField #depositReturned (`shouldBe` depositAmt)
]
eventually "Wallet not delegating" $ do
rGetQuit <- request @ApiWallet ctx (Link.getWallet @'Shelley src) Default Empty
verify rGetQuit
[ expectResponseCode HTTP.status200
, expectField #delegation (`shouldBe` notDelegating [])
]

it "TRANS_NEW_JOIN_01b - Invalid pool id" $ \ctx -> runResourceT $ do
wa <- fixtureWallet ctx
Expand Down

0 comments on commit 3bb2e47

Please sign in to comment.