diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 3f67aa0d02..b284edc801 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -117,6 +117,25 @@ jobs: KEEP_WORKSPACE: 1 run: cabal test all + - # Delete golden files and regenerate them in the next step to ensure + # files that tests designate as golden files are actually golden files + # and can be generated. + name: Delete golden files + shell: bash + run: | + rm -rf cardano-cli/test/cardano-cli-golden/files/golden + + - name: Run tests regenerate golden files + env: + # these two are msys2 env vars, they have no effect on non-msys2 installs. + MSYS2_PATH_TYPE: inherit + MSYSTEM: MINGW64 + TMPDIR: ${{ runner.temp }} + TMP: ${{ runner.temp }} + KEEP_WORKSPACE: 1 + CREATE_GOLDEN_FILES: 1 + run: cabal test all + - name: "Tar artifacts" shell: bash run: | diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/EraBased/Governance/VerifyPoll.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/EraBased/Governance/VerifyPoll.hs index 5d41312374..b171013934 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/EraBased/Governance/VerifyPoll.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/EraBased/Governance/VerifyPoll.hs @@ -26,7 +26,7 @@ hprop_golden_governanceVerifyPoll = propertyOnce $ do pollFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/polls/basic.json" txFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/verify/valid" goldenVkFile <- VerificationKeyFilePath . File <$> - H.note "test/cardano-cli-golden/files/golden/governance/cold.vk" + H.note "test/cardano-cli-golden/files/input/governance/cold.vk" stdout <- BSC.pack <$> execCardanoCLI [ "babbage", "governance", "verify-poll" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs index 3b51f7b499..723d55a800 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs @@ -83,7 +83,7 @@ hprop_golden_conway_stakeaddress_delegate_pool_and_drep = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do vkeyFile <- noteInputFile "test/cardano-cli-golden/files/input/conway/stake.vkey" vkeyPool <- noteInputFile "test/cardano-cli-golden/files/input/conway/poolCold.vkey" - vkeyDrep <- noteInputFile "test/cardano-cli-golden/files/golden/governance/drep/drep.vkey" + vkeyDrep <- noteInputFile "test/cardano-cli-golden/files/input/governance/drep/drep.vkey" delegFile <- H.noteTempFile tempDir "deleg" delegGold <- H.note "test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndDrepVkeyDeleg.cert" @@ -95,4 +95,4 @@ hprop_golden_conway_stakeaddress_delegate_pool_and_drep = , "--out-file", delegFile ] - H.diffFileVsGoldenFile delegFile delegGold \ No newline at end of file + H.diffFileVsGoldenFile delegFile delegGold diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Vote.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Vote.hs index 0c194b2d59..98add1adae 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Vote.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Vote.hs @@ -33,7 +33,7 @@ hprop_golden_governance_governance_vote_create = hprop_golden_governance_governance_vote_view_json_stdout :: Property hprop_golden_governance_governance_vote_view_json_stdout = propertyOnce $ do - voteFile <- noteInputFile "test/cardano-cli-golden/files/golden/governance/vote/vote" + voteFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/vote/vote" voteViewGold <- H.note "test/cardano-cli-golden/files/golden/governance/vote/voteViewJSON" voteView <- execCardanoCLI [ "conway", "governance", "vote", "view" @@ -45,7 +45,7 @@ hprop_golden_governance_governance_vote_view_json_stdout = hprop_golden_governance_governance_vote_view_json_outfile :: Property hprop_golden_governance_governance_vote_view_json_outfile = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - voteFile <- noteInputFile "test/cardano-cli-golden/files/golden/governance/vote/vote" + voteFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/vote/vote" voteViewFile <- H.noteTempFile tempDir "voteView" voteViewGold <- H.note "test/cardano-cli-golden/files/golden/governance/vote/voteViewJSON" void $ execCardanoCLI @@ -59,7 +59,7 @@ hprop_golden_governance_governance_vote_view_json_outfile = hprop_golden_governance_governance_vote_view_yaml :: Property hprop_golden_governance_governance_vote_view_yaml = propertyOnce $ do - voteFile <- noteInputFile "test/cardano-cli-golden/files/golden/governance/vote/vote" + voteFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/vote/vote" voteViewGold <- H.note "test/cardano-cli-golden/files/golden/governance/vote/voteViewYAML" voteView <- execCardanoCLI [ "conway", "governance", "vote", "view" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/InitialTxIn.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/InitialTxIn.hs index 316d7f8726..ee2a6e73fb 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/InitialTxIn.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/InitialTxIn.hs @@ -5,6 +5,7 @@ module Test.Golden.Shelley.Genesis.InitialTxIn where import Test.Cardano.CLI.Util import Hedgehog (Property) +import qualified Hedgehog.Extras as H import qualified Hedgehog.Extras.Test.Golden as H {- HLINT ignore "Use camelCase" -} @@ -12,7 +13,7 @@ import qualified Hedgehog.Extras.Test.Golden as H hprop_golden_shelleyGenesisInitialTxIn :: Property hprop_golden_shelleyGenesisInitialTxIn = propertyOnce $ do verificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_verification_keys/genesis-utxo.vkey" - goldenUtxoHashFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_utxo_hashes/utxo_hash" + goldenUtxoHashFile <- H.note "test/cardano-cli-golden/files/golden/shelley/keys/genesis_utxo_hashes/utxo_hash" utxoHash <- execCardanoCLI [ "genesis","initial-txin" , "--testnet-magic", "16" diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_metadata_hash b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_metadata_hash index 95dd810f73..0b7988d9a3 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_metadata_hash +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_metadata_hash @@ -1 +1 @@ -c9c4e907d758c260823be6999dbbcf2826ac1cdc0fe5f0c9394ac7fa17c74811 +c9c4e907d758c260823be6999dbbcf2826ac1cdc0fe5f0c9394ac7fa17c74811 \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/cold.vk b/cardano-cli/test/cardano-cli-golden/files/input/governance/cold.vk similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/governance/cold.vk rename to cardano-cli/test/cardano-cli-golden/files/input/governance/cold.vk diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep.vkey b/cardano-cli/test/cardano-cli-golden/files/input/governance/drep/drep.vkey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep.vkey rename to cardano-cli/test/cardano-cli-golden/files/input/governance/drep/drep.vkey diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/vote/vote b/cardano-cli/test/cardano-cli-golden/files/input/governance/vote/vote new file mode 100644 index 0000000000..de81fe3c92 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/vote/vote @@ -0,0 +1,5 @@ +{ + "type": "Governance voting procedures", + "description": "", + "cborHex": "a18202581ceb09d5556a8bce421074e394d02c79ced96741657b4cf7ca8995294da1825820b1015258a99351c143a7a40b7b58f033ace10e3cc09c67780ed5b2b0992aa60a05820182781868747470733a2f2f6578616d706c652e636f6d2f766f746558206163683a90d8cb460a38cdcf0d7bab286f0f004ec6e761dc670c2ca4d3709a17" +} diff --git a/cardano-cli/test/cardano-cli-test/Test/Cli/CliIntermediateFormat.hs b/cardano-cli/test/cardano-cli-test/Test/Cli/CliIntermediateFormat.hs index 823b7c4159..7bbbaf770f 100644 --- a/cardano-cli/test/cardano-cli-test/Test/Cli/CliIntermediateFormat.hs +++ b/cardano-cli/test/cardano-cli-test/Test/Cli/CliIntermediateFormat.hs @@ -17,9 +17,9 @@ import qualified Hedgehog.Extras.Test.File as H -- | We test to make sure that we can deserialize a tx body in the intermediate format hprop_backwardsCompatibleCliFormat :: Property hprop_backwardsCompatibleCliFormat = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - txBodyFile <- noteInputFile "test/cardano-cli-test/files/golden/babbage/deprecated-cli-format.body" - witness <- noteInputFile "test/cardano-cli-test/files/golden/babbage/tx-key-witness" - initialUtxo1SigningKeyFile <- noteInputFile "test/cardano-cli-test/files/golden/shelley/keys/payment_keys/signing_key" + txBodyFile <- noteInputFile "test/cardano-cli-test/files/input/babbage/deprecated-cli-format.body" + witness <- noteInputFile "test/cardano-cli-test/files/input/babbage/tx-key-witness" + initialUtxo1SigningKeyFile <- noteInputFile "test/cardano-cli-test/files/input/shelley/keys/payment_keys/signing_key" signedTransactionFile <- noteTempFile tempDir "signed.tx" diff --git a/cardano-cli/test/cardano-cli-test/Test/Cli/Pioneers/Exercise2.hs b/cardano-cli/test/cardano-cli-test/Test/Cli/Pioneers/Exercise2.hs index ed3fd3ba36..77f1ef815a 100644 --- a/cardano-cli/test/cardano-cli-test/Test/Cli/Pioneers/Exercise2.hs +++ b/cardano-cli/test/cardano-cli-test/Test/Cli/Pioneers/Exercise2.hs @@ -36,9 +36,9 @@ hprop_createTransaction = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> d void $ execCardanoCLI [ "transaction", "build-raw" , "--tx-in", "91999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c3#0" - , "--auxiliary-script-file", "test/cardano-cli-test/files/golden/shelley/multisig/scripts/all" + , "--auxiliary-script-file", "test/cardano-cli-test/files/input/shelley/multisig/scripts/all" , "--tx-in", "91999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c3#0" - , "--auxiliary-script-file", "test/cardano-cli-test/files/golden/shelley/multisig/scripts/all" + , "--auxiliary-script-file", "test/cardano-cli-test/files/input/shelley/multisig/scripts/all" , "--tx-out", "addr1v9wmu83pzajplrtpsq6tsqdgwr98x888trpmah2u0ezznsge7del3+100000000" , "--fee", "1000000" , "--invalid-hereafter", "500000" diff --git a/cardano-cli/test/cardano-cli-test/files/golden/babbage/deprecated-cli-format.body b/cardano-cli/test/cardano-cli-test/files/input/babbage/deprecated-cli-format.body similarity index 100% rename from cardano-cli/test/cardano-cli-test/files/golden/babbage/deprecated-cli-format.body rename to cardano-cli/test/cardano-cli-test/files/input/babbage/deprecated-cli-format.body diff --git a/cardano-cli/test/cardano-cli-test/files/golden/babbage/tx-key-witness b/cardano-cli/test/cardano-cli-test/files/input/babbage/tx-key-witness similarity index 100% rename from cardano-cli/test/cardano-cli-test/files/golden/babbage/tx-key-witness rename to cardano-cli/test/cardano-cli-test/files/input/babbage/tx-key-witness diff --git a/cardano-cli/test/cardano-cli-test/files/golden/shelley/keys/payment_keys/signing_key b/cardano-cli/test/cardano-cli-test/files/input/shelley/keys/payment_keys/signing_key similarity index 100% rename from cardano-cli/test/cardano-cli-test/files/golden/shelley/keys/payment_keys/signing_key rename to cardano-cli/test/cardano-cli-test/files/input/shelley/keys/payment_keys/signing_key diff --git a/cardano-cli/test/cardano-cli-test/files/golden/shelley/multisig/scripts/all b/cardano-cli/test/cardano-cli-test/files/input/shelley/multisig/scripts/all similarity index 100% rename from cardano-cli/test/cardano-cli-test/files/golden/shelley/multisig/scripts/all rename to cardano-cli/test/cardano-cli-test/files/input/shelley/multisig/scripts/all