Skip to content

Commit

Permalink
Merge pull request #454 from IntersectMBO/newhoggy/move-input-files-o…
Browse files Browse the repository at this point in the history
…ut-of-golden-directory

Move input files out of `golden` directory
  • Loading branch information
newhoggy authored Jan 7, 2024
2 parents 8222848 + 2381388 commit 658243b
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 13 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -95,4 +95,4 @@ hprop_golden_conway_stakeaddress_delegate_pool_and_drep =
, "--out-file", delegFile
]

H.diffFileVsGoldenFile delegFile delegGold
H.diffFileVsGoldenFile delegFile delegGold
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ 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" -}

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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c9c4e907d758c260823be6999dbbcf2826ac1cdc0fe5f0c9394ac7fa17c74811
c9c4e907d758c260823be6999dbbcf2826ac1cdc0fe5f0c9394ac7fa17c74811
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Governance voting procedures",
"description": "",
"cborHex": "a18202581ceb09d5556a8bce421074e394d02c79ced96741657b4cf7ca8995294da1825820b1015258a99351c143a7a40b7b58f033ace10e3cc09c67780ed5b2b0992aa60a05820182781868747470733a2f2f6578616d706c652e636f6d2f766f746558206163683a90d8cb460a38cdcf0d7bab286f0f004ec6e761dc670c2ca4d3709a17"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 658243b

Please sign in to comment.