Skip to content

Commit 0fcc496

Browse files
authored
Merge pull request #6504 from IntersectMBO/fix/flaky-multiasset-collateral-test
Fix flaky MultiAssetReturnCollateral test
2 parents 0f93401 + 014595c commit 0fcc496

2 files changed

Lines changed: 64 additions & 8 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
For top level release notes, leave all the headers commented out.
6+
-->
7+
8+
<!--
9+
### Removed
10+
11+
- A bullet item for the Removed category.
12+
13+
-->
14+
<!--
15+
### Added
16+
17+
- A bullet item for the Added category.
18+
19+
-->
20+
<!--
21+
### Changed
22+
23+
- A bullet item for the Changed category.
24+
25+
-->
26+
<!--
27+
### Deprecated
28+
29+
- A bullet item for the Deprecated category.
30+
31+
-->
32+
### Fixed
33+
34+
- Fixed flaky `MultiAssetReturnCollateral` test by using deterministic UTxO
35+
selection instead of relying on query ordering.
36+
37+
<!--
38+
### Security
39+
40+
- A bullet item for the Security category.
41+
42+
-->
43+
<!--
44+
### Tests
45+
46+
- A bullet item for the Tests category.
47+
48+
-->
49+
<!--
50+
### Documentation
51+
52+
- A bullet item for the Documentation category.
53+
54+
-->
55+
<!--
56+
### Maintenance
57+
58+
- A bullet item for the Maintenance category.
59+
60+
-->

cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/MultiAssetReturnCollateral.hs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import Testnet.Components.Configuration
2222
import Testnet.Components.Query
2323
import Testnet.Defaults
2424
import Testnet.Process.Run (execCli', mkExecConfig)
25-
import Testnet.Property.Util (integrationWorkspace)
25+
import Testnet.Property.Util (integrationRetryWorkspace)
2626
import Testnet.Types
2727

2828
import Hedgehog (Property)
@@ -31,7 +31,7 @@ import qualified Hedgehog.Extras as H
3131

3232
-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Collateral With Multiassets/"'@
3333
hprop_collateral_with_tokens :: Property
34-
hprop_collateral_with_tokens = integrationWorkspace "collateral-with-tokens" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
34+
hprop_collateral_with_tokens = integrationRetryWorkspace 2 "collateral-with-tokens" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
3535
conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath'
3636
let tempAbsPath' = unTmpAbsPath tempAbsPath
3737
work <- H.createDirectoryIfMissing $ tempAbsPath' </> "work"
@@ -145,13 +145,9 @@ hprop_collateral_with_tokens = integrationWorkspace "collateral-with-tokens" $ \
145145
-- STEP 2: Attempt to spend from script with collateral containing tokens
146146
-- This will fail because collateral cannot contain non-ADA tokens
147147

148-
-- Wait for transactions to be processed and find UTxOs
149-
_ <- waitForBlocks epochStateView 1
150-
151-
-- Find the UTxO with tokens at wallet1 (for collateral)
152-
txinCollateralWithTokensM <-
148+
-- Find the UTxO with tokens at wallet2 (for collateral)
149+
(txinCollateralWithTokens, collateralTxOut) <- retryUntilJustM epochStateView (WaitForBlocks 10) $
153150
findLargestMultiAssetUtxoWithAddress epochStateView sbe $ T.pack maCollateralAddress
154-
(txinCollateralWithTokens, collateralTxOut) <- H.evalMaybe txinCollateralWithTokensM
155151
H.note_ "Collateral TxOut"
156152
H.noteShow_ collateralTxOut
157153
-- Find the UTxO at the script address

0 commit comments

Comments
 (0)