Skip to content

Commit 2a82d68

Browse files
committed
Reenable cardano-testnet-tests
1 parent 77b222e commit 2a82d68

File tree

4 files changed

+73
-63
lines changed

4 files changed

+73
-63
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBa
139139
]
140140

141141
-- 2. Successfully spend conway spending script
142+
_ <- waitForBlocks epochStateView 2
142143
txinCollateral <- findLargestUtxoForPaymentKey epochStateView sbe wallet1
143144
plutusScriptTxIn <- fmap fst . retryUntilJustM epochStateView (WaitForBlocks 3) $
144145
findLargestUtxoWithAddress epochStateView sbe $ Text.pack plutusSpendingScriptAddr

cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@ import GHC.Exts (IsList (..))
5757
import GHC.Stack (HasCallStack, withFrozenCallStack)
5858
import qualified GHC.Stack as GHC
5959
import Lens.Micro ((^.))
60+
import System.Directory (makeAbsolute)
6061
import System.FilePath ((</>))
6162

6263
import Testnet.Components.Configuration (eraToString)
6364
import Testnet.Components.Query (EpochStateView, checkDRepsNumber, getEpochStateView,
6465
watchEpochStateUpdate)
6566
import qualified Testnet.Defaults as Defaults
66-
import Testnet.Process.Cli.Transaction (
67-
mkSimpleSpendOutputsOnlyTx, retrieveTransactionId, signTx,
68-
submitTx)
67+
import Testnet.Process.Cli.Transaction (TxOutAddress (..), mkSimpleSpendOutputsOnlyTx,
68+
mkSpendOutputsOnlyTx, retrieveTransactionId, signTx, submitTx)
6969
import Testnet.Process.Run (execCli', execCliStdoutToJson, mkExecConfig)
7070
import Testnet.Property.Assert (assertErasEqual)
7171
import Testnet.Property.Util (integrationWorkspace)
72-
import Testnet.Start.Types (ShelleyTestnetOptions(..))
72+
import Testnet.Start.Types (ShelleyTestnetOptions (..))
7373
import Testnet.TestQueryCmds (TestQueryCmds (..), forallQueryCommands)
7474
import Testnet.Types
7575

@@ -328,31 +328,31 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
328328
-- This is tested in hprop_querySlotNumber in Cardano.Testnet.Test.Cli.QuerySlotNumber
329329
pure ()
330330

331-
332-
TestQueryRefScriptSizeCmd -> pure () -- TODO: Failing intermittently cardano-node-9.2
333-
-- -- ref-script-size
334-
-- do
335-
-- -- Set up files and vars
336-
-- refScriptSizeWork <- H.createDirectoryIfMissing $ work </> "ref-script-size-test"
337-
-- plutusV3Script <- File <$> liftIO (makeAbsolute "test/cardano-testnet-test/files/plutus/v3/always-succeeds.plutus")
338-
-- let transferAmount = Coin 10_000_000
339-
-- -- Submit a transaction to publish the reference script
340-
-- txBody <- mkSpendOutputsOnlyTx execConfig epochStateView sbe refScriptSizeWork "tx-body" wallet1
341-
-- [(ReferenceScriptAddress plutusV3Script, transferAmount)]
342-
-- signedTx <- signTx execConfig cEra refScriptSizeWork "signed-tx" txBody [SomeKeyPair $ paymentKeyInfoPair wallet1]
343-
-- submitTx execConfig cEra signedTx
344-
-- -- Wait until transaction is on chain and obtain transaction identifier
345-
-- txId <- retrieveTransactionId execConfig signedTx
346-
-- txIx <- H.evalMaybeM $ watchEpochStateUpdate epochStateView (EpochInterval 2) (getTxIx sbe txId transferAmount)
347-
-- -- Query the reference script size
348-
-- let protocolParametersOutFile = refScriptSizeWork </> "ref-script-size-out.json"
349-
-- H.noteM_ $ execCli' execConfig [ eraName, "query", "ref-script-size"
350-
-- , "--tx-in", txId ++ "#" ++ show (txIx :: Int)
351-
-- , "--out-file", protocolParametersOutFile
352-
-- ]
353-
-- H.diffFileVsGoldenFile
354-
-- protocolParametersOutFile
355-
-- "test/cardano-testnet-test/files/golden/queries/refScriptSizeOut.json"
331+
332+
TestQueryRefScriptSizeCmd ->
333+
-- ref-script-size
334+
do
335+
-- Set up files and vars
336+
refScriptSizeWork <- H.createDirectoryIfMissing $ work </> "ref-script-size-test"
337+
plutusV3Script <- File <$> liftIO (makeAbsolute "test/cardano-testnet-test/files/plutus/v3/always-succeeds.plutus")
338+
let transferAmount = Coin 10_000_000
339+
-- Submit a transaction to publish the reference script
340+
txBody <- mkSpendOutputsOnlyTx execConfig epochStateView sbe refScriptSizeWork "tx-body" wallet1
341+
[(ReferenceScriptAddress plutusV3Script, transferAmount)]
342+
signedTx <- signTx execConfig cEra refScriptSizeWork "signed-tx" txBody [SomeKeyPair $ paymentKeyInfoPair wallet1]
343+
submitTx execConfig cEra signedTx
344+
-- Wait until transaction is on chain and obtain transaction identifier
345+
txId <- retrieveTransactionId execConfig signedTx
346+
txIx <- H.evalMaybeM $ watchEpochStateUpdate epochStateView (EpochInterval 2) (getTxIx sbe txId transferAmount)
347+
-- Query the reference script size
348+
let protocolParametersOutFile = refScriptSizeWork </> "ref-script-size-out.json"
349+
H.noteM_ $ execCli' execConfig [ eraName, "query", "ref-script-size"
350+
, "--tx-in", txId ++ "#" ++ show (txIx :: Int)
351+
, "--out-file", protocolParametersOutFile
352+
]
353+
H.diffFileVsGoldenFile
354+
protocolParametersOutFile
355+
"test/cardano-testnet-test/files/golden/queries/refScriptSizeOut.json"
356356

357357
TestQueryConstitutionCmd ->
358358
-- constitution
@@ -465,8 +465,8 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
465465
verificationStakeKeyToStakeAddress testnetMagic delegatorVKey =
466466
makeStakeAddress (fromNetworkMagic $ NetworkMagic $ fromIntegral testnetMagic) (StakeCredentialByKey $ verificationKeyHash delegatorVKey)
467467

468-
_getTxIx :: forall m era. HasCallStack => MonadTest m => ShelleyBasedEra era -> String -> Coin -> (AnyNewEpochState, SlotNo, BlockNo) -> m (Maybe Int)
469-
_getTxIx sbe txId amount (AnyNewEpochState sbe' newEpochState, _, _) = do
468+
getTxIx :: forall m era. HasCallStack => MonadTest m => ShelleyBasedEra era -> String -> Coin -> (AnyNewEpochState, SlotNo, BlockNo) -> m (Maybe Int)
469+
getTxIx sbe txId amount (AnyNewEpochState sbe' newEpochState, _, _) = do
470470
Refl <- H.leftFail $ assertErasEqual sbe sbe'
471471
shelleyBasedEraConstraints sbe' (do
472472
return $ Map.foldlWithKey (\acc (L.TxIn (L.TxId thisTxId) (L.TxIx thisTxIx)) txOut ->

cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ import qualified Testnet.Process.Cli.SPO as SPO
4444
import Testnet.Process.Cli.Transaction
4545
import Testnet.Process.Run (execCli', mkExecConfig)
4646
import Testnet.Property.Util (integrationWorkspace)
47+
import Testnet.Start.Types (ShelleyTestnetOptions (..))
4748
import Testnet.Types
48-
import Testnet.Start.Types (ShelleyTestnetOptions(..))
4949

5050
import Hedgehog
5151
import qualified Hedgehog.Extras as H
@@ -63,7 +63,7 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co
6363
-- how many votes to cast
6464
let drepVotes, spoVotes :: [(String, Int)]
6565
drepVotes = zip (concatMap (uncurry replicate) [(5, "yes"), (3, "no"), (2, "abstain")]) [1..]
66-
spoVotes = zip (concatMap (uncurry replicate) [(1, "yes")]) [1..]
66+
spoVotes = zip (replicate 1 "yes") [1..]
6767
H.noteShow_ drepVotes
6868

6969
let nDrepVotes :: Int
@@ -225,7 +225,8 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co
225225
length (filter ((== L.VoteYes) . snd) gaSpoVotes) === 1
226226
length spoVotes === length gaSpoVotes
227227

228-
H.nothingFailM $ watchEpochStateUpdate epochStateView (L.EpochInterval 1) (return . committeeIsPresent)
228+
_ <- waitForBlocks epochStateView 2
229+
H.nothingFailM $ watchEpochStateUpdate epochStateView (L.EpochInterval 2) (return . committeeIsPresent)
229230

230231
-- show proposed committe meembers
231232
H.noteShow_ ccCredentials

cardano-testnet/test/cardano-testnet-test/cardano-testnet-test.hs

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,25 @@ module Main
55
) where
66

77
import qualified Cardano.Crypto.Init as Crypto
8-
import qualified Cardano.Testnet.Test.Cli.StakeSnapshot
9-
import qualified Cardano.Testnet.Test.Cli.Transaction
8+
import qualified Cardano.Testnet.Test.Cli.Conway.Plutus
109
import qualified Cardano.Testnet.Test.Cli.KesPeriodInfo
10+
import qualified Cardano.Testnet.Test.Cli.LeadershipSchedule
11+
import qualified Cardano.Testnet.Test.Cli.Query
1112
import qualified Cardano.Testnet.Test.Cli.QuerySlotNumber
13+
import qualified Cardano.Testnet.Test.Cli.StakeSnapshot
14+
import qualified Cardano.Testnet.Test.Cli.Transaction
1215
import qualified Cardano.Testnet.Test.FoldEpochState
16+
import qualified Cardano.Testnet.Test.Gov.CommitteeAddNew as Gov
17+
import qualified Cardano.Testnet.Test.Gov.DRepDeposit as Gov
18+
import qualified Cardano.Testnet.Test.Gov.DRepRetirement as Gov
19+
import qualified Cardano.Testnet.Test.Gov.GovActionTimeout as Gov
20+
import qualified Cardano.Testnet.Test.Gov.NoConfidence as Gov
21+
import qualified Cardano.Testnet.Test.Gov.PParamChangeFailsSPO as Gov
22+
import qualified Cardano.Testnet.Test.Gov.ProposeNewConstitution as Gov
23+
import qualified Cardano.Testnet.Test.Gov.ProposeNewConstitutionSPO as Gov
24+
import qualified Cardano.Testnet.Test.Gov.TreasuryDonation as Gov
25+
import qualified Cardano.Testnet.Test.Gov.TreasuryGrowth as Gov
26+
import qualified Cardano.Testnet.Test.Gov.TreasuryWithdrawal as Gov
1327
import qualified Cardano.Testnet.Test.Node.Shutdown
1428
import qualified Cardano.Testnet.Test.SanityCheck as LedgerEvents
1529
import qualified Cardano.Testnet.Test.SubmitApi.Transaction
@@ -29,34 +43,30 @@ tests = do
2943
pure $ T.testGroup "test/Spec.hs"
3044
[ T.testGroup "Spec"
3145
[ T.testGroup "Ledger Events"
32-
[ ignoreOnWindows "Sanity Check" LedgerEvents.hprop_ledger_events_sanity_check
33-
-- , ignoreOnWindows "Treasury Growth" Gov.prop_check_if_treasury_is_growing
46+
[ ignoreOnWindows "Sanity Check" LedgerEvents.hprop_ledger_events_sanity_check
47+
, ignoreOnWindows "Treasury Growth" Gov.prop_check_if_treasury_is_growing
3448
-- TODO: Replace foldBlocks with checkConditionResult
3549
-- TODO: All governance related tests disabled in cardano-node-9.2 due to flakiness
36-
--, T.testGroup "Governance"
37-
-- [ ignoreOnMacAndWindows "Committee Add New" Gov.hprop_constitutional_committee_add_new
38-
-- Committee Motion Of No Confidence - disabled in cardano-node-9.2
39-
-- , ignoreOnMacAndWindows "Committee Motion Of No Confidence" Gov.hprop_gov_no_confidence
50+
, T.testGroup "Governance"
51+
[ ignoreOnMacAndWindows "Committee Add New" Gov.hprop_constitutional_committee_add_new
52+
, ignoreOnMacAndWindows "Committee Motion Of No Confidence" Gov.hprop_gov_no_confidence
4053
-- TODO: Disabled because proposals for parameter changes are not working
4154
-- , ignoreOnWindows "DRep Activity" Gov.hprop_check_drep_activity
42-
-- , ignoreOnWindows "Predefined Abstain DRep" Gov.hprop_check_predefined_abstain_drep
43-
-- DRep Deposits flakey - disabled in cardano-node-9.2
44-
-- , ignoreOnWindows "DRep Deposits" Gov.hprop_ledger_events_drep_deposits
45-
-- , ignoreOnWindows "DRep Retirement" Gov.hprop_drep_retirement
46-
-- , ignoreOnMacAndWindows "Propose And Ratify New Constitution" Gov.hprop_ledger_events_propose_new_constitution
47-
-- , ignoreOnWindows "Propose New Constitution SPO" Gov.hprop_ledger_events_propose_new_constitution_spo
48-
-- , ignoreOnWindows "Gov Action Timeout" Gov.hprop_check_gov_action_timeout
49-
-- , ignoreOnWindows "Treasury Donation" Gov.hprop_ledger_events_treasury_donation
50-
-- Treasury Withdrawal flakey - disabled in cardano-node-9.2
51-
-- , ignoreOnMacAndWindows "Treasury Withdrawal" Gov.hprop_ledger_events_treasury_withdrawal
52-
-- , ignoreOnWindows "PParam change fails for SPO" Gov.hprop_check_pparam_fails_spo
55+
-- , ignoreOnWindows "Predefined Abstain DRep" Gov.hprop_check_predefined_abstain_drep
56+
, ignoreOnWindows "DRep Deposits" Gov.hprop_ledger_events_drep_deposits
57+
, ignoreOnWindows "DRep Retirement" Gov.hprop_drep_retirement
58+
, ignoreOnMacAndWindows "Propose And Ratify New Constitution" Gov.hprop_ledger_events_propose_new_constitution
59+
, ignoreOnWindows "Propose New Constitution SPO" Gov.hprop_ledger_events_propose_new_constitution_spo
60+
, ignoreOnWindows "Gov Action Timeout" Gov.hprop_check_gov_action_timeout
61+
, ignoreOnWindows "Treasury Donation" Gov.hprop_ledger_events_treasury_donation
62+
, ignoreOnMacAndWindows "Treasury Withdrawal" Gov.hprop_ledger_events_treasury_withdrawal
63+
, ignoreOnWindows "PParam change fails for SPO" Gov.hprop_check_pparam_fails_spo
5364
-- FIXME Those tests are flaky
5465
-- , ignoreOnWindows "InfoAction" LedgerEvents.hprop_ledger_events_info_action
5566
]
56-
-- Plutus flakey - disabled in cardano-node-9.2
57-
-- , T.testGroup "Plutus"
58-
-- [ ignoreOnWindows "PlutusV3" Cardano.Testnet.Test.Cli.Conway.Plutus.hprop_plutus_v3]
59-
67+
, T.testGroup "Plutus"
68+
[ ignoreOnWindows "PlutusV3" Cardano.Testnet.Test.Cli.Conway.Plutus.hprop_plutus_v3]
69+
]
6070
, T.testGroup "CLI"
6171
[ ignoreOnWindows "Shutdown" Cardano.Testnet.Test.Node.Shutdown.hprop_shutdown
6272
-- ShutdownOnSigint fails on Mac with
@@ -66,8 +76,7 @@ tests = do
6676
-- , ignoreOnWindows "ShutdownOnSlotSynced" Cardano.Testnet.Test.Node.Shutdown.hprop_shutdownOnSlotSynced
6777
, ignoreOnWindows "stake-snapshot" Cardano.Testnet.Test.Cli.StakeSnapshot.hprop_stakeSnapshot
6878
, ignoreOnWindows "simple transaction build" Cardano.Testnet.Test.Cli.Transaction.hprop_transaction
69-
-- "leadership-schedule" flakey - disabled in cardano-node-9.2
70-
-- , ignoreOnMacAndWindows "leadership-schedule" Cardano.Testnet.Test.Cli.LeadershipSchedule.hprop_leadershipSchedule
79+
, ignoreOnMacAndWindows "leadership-schedule" Cardano.Testnet.Test.Cli.LeadershipSchedule.hprop_leadershipSchedule
7180

7281
-- TODO: Conway - Re-enable when create-staked is working in conway again
7382
--, T.testGroup "Conway"
@@ -78,13 +87,12 @@ tests = do
7887
, ignoreOnWindows "kes-period-info" Cardano.Testnet.Test.Cli.KesPeriodInfo.hprop_kes_period_info
7988
, ignoreOnWindows "query-slot-number" Cardano.Testnet.Test.Cli.QuerySlotNumber.hprop_querySlotNumber
8089
, ignoreOnWindows "foldEpochState receives ledger state" Cardano.Testnet.Test.FoldEpochState.prop_foldEpochState
81-
-- , ignoreOnMacAndWindows "CliQueries" Cardano.Testnet.Test.Cli.Query.hprop_cli_queries
90+
, ignoreOnMacAndWindows "CliQueries" Cardano.Testnet.Test.Cli.Query.hprop_cli_queries
8291
]
8392
]
8493
, T.testGroup "SubmitApi"
85-
[ ignoreOnMacAndWindows "transaction" Cardano.Testnet.Test.SubmitApi.Transaction.hprop_transaction
86-
]
87-
94+
[ ignoreOnMacAndWindows "transaction" Cardano.Testnet.Test.SubmitApi.Transaction.hprop_transaction
95+
]
8896
]
8997

9098
main :: IO ()

0 commit comments

Comments
 (0)