diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index ee5f7a1a2b..afefd511eb 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -274,7 +274,9 @@ library cardano-cli-test-lib , bytestring , cardano-api , cardano-cli + , directory , exceptions + , filepath , hedgehog , hedgehog-extras ^>= 0.4.7.0 , process diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/SigningKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/SigningKeys.hs index a1961f1e79..b074b77b2c 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/SigningKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/SigningKeys.hs @@ -32,21 +32,21 @@ import Hedgehog.Internal.Property (failWith) hprop_deserialise_legacy_signing_Key :: Property hprop_deserialise_legacy_signing_Key = propertyOnce $ do - legSkeyBs <- H.evalIO $ LB.readFile "test/cardano-cli-golden/files/golden/byron/keys/legacy.skey" + legSkeyBs <- H.evalIO $ LB.readFile "test/cardano-cli-golden/files/input/byron/keys/legacy.skey" case deserialiseFromBytes decodeLegacyDelegateKey legSkeyBs of Left deSerFail -> failWith Nothing $ show deSerFail Right _ -> success hprop_deserialise_nonLegacy_signing_Key :: Property hprop_deserialise_nonLegacy_signing_Key = propertyOnce $ do - skeyBs <- H.evalIO $ LB.readFile "test/cardano-cli-golden/files/golden/byron/keys/byron.skey" + skeyBs <- H.evalIO $ LB.readFile "test/cardano-cli-golden/files/input/byron/keys/byron.skey" case deserialiseFromBytes Crypto.fromCBORXPrv skeyBs of Left deSerFail -> failWith Nothing $ show deSerFail Right _ -> success hprop_print_legacy_signing_key_address :: Property hprop_print_legacy_signing_key_address = propertyOnce $ do - let legKeyFp = "test/cardano-cli-golden/files/golden/byron/keys/legacy.skey" + let legKeyFp = "test/cardano-cli-golden/files/input/byron/keys/legacy.skey" void $ execCardanoCLI [ "signing-key-address", "--byron-legacy-formats" @@ -62,7 +62,7 @@ hprop_print_legacy_signing_key_address = propertyOnce $ do hprop_print_nonLegacy_signing_key_address :: Property hprop_print_nonLegacy_signing_key_address = propertyOnce $ do - let nonLegKeyFp = "test/cardano-cli-golden/files/golden/byron/keys/byron.skey" + let nonLegKeyFp = "test/cardano-cli-golden/files/input/byron/keys/byron.skey" void $ execCardanoCLI [ "signing-key-address", "--byron-formats" @@ -86,7 +86,7 @@ hprop_generate_and_read_nonlegacy_signingkeys = property $ do hprop_migrate_legacy_to_nonlegacy_signingkeys :: Property hprop_migrate_legacy_to_nonlegacy_signingkeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - let legKeyFp = "test/cardano-cli-golden/files/golden/byron/keys/legacy.skey" + let legKeyFp = "test/cardano-cli-golden/files/input/byron/keys/legacy.skey" nonLegacyKeyFp <- noteTempFile tempDir "nonlegacy.skey" void $ execCardanoCLI @@ -104,14 +104,14 @@ hprop_migrate_legacy_to_nonlegacy_signingkeys = hprop_deserialise_NonLegacy_Signing_Key_API :: Property hprop_deserialise_NonLegacy_Signing_Key_API = propertyOnce $ do - eFailOrWit <- H.evalIO . runExceptT $ readByronSigningKey NonLegacyByronKeyFormat "test/cardano-cli-golden/files/golden/byron/keys/byron.skey" + eFailOrWit <- H.evalIO . runExceptT $ readByronSigningKey NonLegacyByronKeyFormat "test/cardano-cli-golden/files/input/byron/keys/byron.skey" case eFailOrWit of Left keyFailure -> failWith Nothing $ show keyFailure Right _ -> success hprop_deserialiseLegacy_Signing_Key_API :: Property hprop_deserialiseLegacy_Signing_Key_API = propertyOnce $ do - eFailOrWit <- H.evalIO . runExceptT $ readByronSigningKey LegacyByronKeyFormat "test/cardano-cli-golden/files/golden/byron/keys/legacy.skey" + eFailOrWit <- H.evalIO . runExceptT $ readByronSigningKey LegacyByronKeyFormat "test/cardano-cli-golden/files/input/byron/keys/legacy.skey" case eFailOrWit of Left keyFailure -> failWith Nothing $ show keyFailure Right _ -> success diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Tx.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Tx.hs index ed3239782e..7facd6aef2 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Tx.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Tx.hs @@ -22,10 +22,10 @@ import Hedgehog.Internal.Property (failWith) {- HLINT ignore "Use camelCase" -} -hprop_golden_byronTx_legacy :: Property -hprop_golden_byronTx_legacy = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - signingKey <- noteInputFile "test/cardano-cli-golden/files/golden/byron/keys/legacy.skey" - goldenTx <- noteInputFile "test/cardano-cli-golden/files/golden/byron/tx/legacy.tx" +hprop_byronTx_legacy :: Property +hprop_byronTx_legacy = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do + signingKey <- noteInputFile "test/cardano-cli-golden/files/input/byron/keys/legacy.skey" + expectedTx <- noteInputFile "test/cardano-cli-golden/files/input/byron/tx/legacy.tx" createdTx <- noteTempFile tempDir "tx" void $ execCardanoCLI [ "byron", "transaction", "issue-utxo-expenditure" @@ -37,12 +37,12 @@ hprop_golden_byronTx_legacy = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir , "--txout", "(\"2657WMsDfac6eFirdvKVPVMxNVYuACd1RGM2arH3g1y1yaQCr1yYpb2jr2b2aSiDZ\",999)" ] - compareByronTxs createdTx goldenTx + compareByronTxs createdTx expectedTx -hprop_golden_byronTx :: Property -hprop_golden_byronTx = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - signingKey <- noteInputFile "test/cardano-cli-golden/files/golden/byron/keys/byron.skey" - goldenTx <- noteInputFile "test/cardano-cli-golden/files/golden/byron/tx/normal.tx" +hprop_byronTx :: Property +hprop_byronTx = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do + signingKey <- noteInputFile "test/cardano-cli-golden/files/input/byron/keys/byron.skey" + expectedTx <- noteInputFile "test/cardano-cli-golden/files/input/byron/tx/normal.tx" createdTx <- noteTempFile tempDir "tx" void $ execCardanoCLI [ "byron", "transaction", "issue-utxo-expenditure" @@ -54,7 +54,7 @@ hprop_golden_byronTx = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do , "--txout", "(\"2657WMsDfac6eFirdvKVPVMxNVYuACd1RGM2arH3g1y1yaQCr1yYpb2jr2b2aSiDZ\",999)" ] - compareByronTxs createdTx goldenTx + compareByronTxs createdTx expectedTx getTxByteString :: FilePath -> H.PropertyT IO (ATxAux ByteString) getTxByteString txFp = do @@ -64,8 +64,8 @@ getTxByteString txFp = do Right aTxAuxBS -> return aTxAuxBS compareByronTxs :: FilePath -> FilePath -> H.PropertyT IO () -compareByronTxs createdTx goldenTx = do +compareByronTxs createdTx expectedTx = do createdATxAuxBS <- getTxByteString createdTx - goldenATxAuxBS <- getTxByteString goldenTx + expectedATxAuxBS <- getTxByteString expectedTx - normalByronTxToGenTx goldenATxAuxBS === normalByronTxToGenTx createdATxAuxBS + normalByronTxToGenTx expectedATxAuxBS === normalByronTxToGenTx createdATxAuxBS diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs index 944ba9b8cb..228c7207f1 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs @@ -17,10 +17,10 @@ import Hedgehog.Internal.Property (failWith) {- HLINT ignore "Use camelCase" -} -hprop_golden_byron_update_proposal :: Property -hprop_golden_byron_update_proposal = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - goldenUpdateProposal <- noteInputFile "test/cardano-cli-golden/files/golden/byron/update-proposal" - signingKey <- noteInputFile "test/cardano-cli-golden/files/golden/byron/keys/byron.skey" +hprop_byron_update_proposal :: Property +hprop_byron_update_proposal = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do + expectedUpdateProposal <- noteInputFile "test/cardano-cli-golden/files/input/byron/update-proposal" + signingKey <- noteInputFile "test/cardano-cli-golden/files/input/byron/keys/byron.skey" createdUpdateProposal <- noteTempFile tempDir "byron-update-proposal" void $ execCardanoCLI [ "byron", "governance", "create-update-proposal" @@ -36,8 +36,8 @@ hprop_golden_byron_update_proposal = propertyOnce $ H.moduleWorkspace "tmp" $ \t , "--filepath", createdUpdateProposal ] - eGolden <- liftIO . runExceptT $ readByronUpdateProposal goldenUpdateProposal - golden <- case eGolden of + eExpected <- liftIO . runExceptT $ readByronUpdateProposal expectedUpdateProposal + expected <- case eExpected of Left err -> failWith Nothing . Text.unpack $ renderByronUpdateProposalError err Right prop -> return prop @@ -46,4 +46,4 @@ hprop_golden_byron_update_proposal = propertyOnce $ H.moduleWorkspace "tmp" $ \t Left err -> failWith Nothing . Text.unpack $ renderByronUpdateProposalError err Right prop -> return prop - golden === created + expected === created diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs index c468bcc442..d40dfc461d 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs @@ -17,11 +17,11 @@ import Hedgehog.Internal.Property (failWith) {- HLINT ignore "Use camelCase" -} -hprop_golden_byron_yes_vote :: Property -hprop_golden_byron_yes_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - goldenYesVote <- noteInputFile "test/cardano-cli-golden/files/golden/byron/votes/vote-yes" - proposal <- noteInputFile "test/cardano-cli-golden/files/golden/byron/update-proposal" - signingKey <- noteInputFile "test/cardano-cli-golden/files/golden/byron/keys/byron.skey" +hprop_byron_yes_vote :: Property +hprop_byron_yes_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do + expectedYesVote <- noteInputFile "test/cardano-cli-golden/files/input/byron/votes/vote-yes" + proposal <- noteInputFile "test/cardano-cli-golden/files/input/byron/update-proposal" + signingKey <- noteInputFile "test/cardano-cli-golden/files/input/byron/keys/byron.skey" createdYesVote <- noteTempFile tempDir "byron-yes-vote" void $ execCardanoCLI [ "byron", "governance", "create-proposal-vote" @@ -32,8 +32,8 @@ hprop_golden_byron_yes_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir , "--output-filepath", createdYesVote ] - eGolden <- liftIO . runExceptT $ readByronVote goldenYesVote - golden <- case eGolden of + eExpected <- liftIO . runExceptT $ readByronVote expectedYesVote + expected <- case eExpected of Left err -> failWith Nothing . Text.unpack $ renderByronVoteError err Right prop -> return prop @@ -42,13 +42,13 @@ hprop_golden_byron_yes_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir Left err -> failWith Nothing . Text.unpack $ renderByronVoteError err Right prop -> return prop - golden === created + expected === created -hprop_golden_byron_no_vote :: Property -hprop_golden_byron_no_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - goldenNoVote <- noteInputFile "test/cardano-cli-golden/files/golden/byron/votes/vote-no" - proposal <- noteInputFile "test/cardano-cli-golden/files/golden/byron/update-proposal" - signingKey <- noteInputFile "test/cardano-cli-golden/files/golden/byron/keys/byron.skey" +hprop_byron_no_vote :: Property +hprop_byron_no_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do + expectedNoVote <- noteInputFile "test/cardano-cli-golden/files/input/byron/votes/vote-no" + proposal <- noteInputFile "test/cardano-cli-golden/files/input/byron/update-proposal" + signingKey <- noteInputFile "test/cardano-cli-golden/files/input/byron/keys/byron.skey" createdNoVote <- noteTempFile tempDir "byron-no-vote" void $ execCardanoCLI [ "byron", "governance", "create-proposal-vote" @@ -59,8 +59,8 @@ hprop_golden_byron_no_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir - , "--output-filepath", createdNoVote ] - eGolden <- liftIO . runExceptT $ readByronVote goldenNoVote - golden <- case eGolden of + eExpected <- liftIO . runExceptT $ readByronVote expectedNoVote + expected <- case eExpected of Left err -> failWith Nothing . Text.unpack $ renderByronVoteError err Right prop -> return prop @@ -69,4 +69,4 @@ hprop_golden_byron_no_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir - Left err -> failWith Nothing . Text.unpack $ renderByronVoteError err Right prop -> return prop - golden === created + expected === created diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Key/NonExtendedKey.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Key/NonExtendedKey.hs index 2a3b14c753..05b30767f8 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Key/NonExtendedKey.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Key/NonExtendedKey.hs @@ -5,6 +5,7 @@ module Test.Golden.Key.NonExtendedKey where import Control.Monad (void) import System.FilePath (()) +import qualified Test.Cardano.CLI.Util as H import Test.Cardano.CLI.Util (execCardanoCLI, propertyOnce) import Hedgehog (Property) @@ -19,7 +20,7 @@ import qualified Hedgehog.Extras.Test.Golden as H hprop_golden_KeyNonExtendedKey_GenesisExtendedVerificationKey :: Property hprop_golden_KeyNonExtendedKey_GenesisExtendedVerificationKey = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - genesisVKeyFp <- H.note "test/cardano-cli-golden/files/golden/key/non-extended-keys/shelley.000.vkey" + genesisVKeyFp <- H.noteInputFile "test/cardano-cli-golden/files/input/key/non-extended-keys/shelley.000.vkey" nonExtendedFp <- H.note "test/cardano-cli-golden/files/golden/key/non-extended-keys/non-extended-shelley.000.vkey" outFp <- H.note $ tempDir "non-extended-shelley.000.vkey" @@ -42,7 +43,7 @@ hprop_golden_KeyNonExtendedKey_GenesisExtendedVerificationKey = hprop_golden_KeyNonExtendedKey_StakeExtendedVerificationKeyShelley :: Property hprop_golden_KeyNonExtendedKey_StakeExtendedVerificationKeyShelley = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - genesisVKeyFp <- H.note "test/cardano-cli-golden/files/golden/key/non-extended-keys/stake.000.vkey" + genesisVKeyFp <- H.noteInputFile "test/cardano-cli-golden/files/input/key/non-extended-keys/stake.000.vkey" nonExtendedFp <- H.note "test/cardano-cli-golden/files/golden/key/non-extended-keys/non-extended-stake.000.vkey" outFp <- H.note $ tempDir "non-extended-stake.000.vkey" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Address/Build.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Address/Build.hs index 6a581fef77..7c36f20adc 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Address/Build.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Address/Build.hs @@ -14,10 +14,10 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyAddressBuild :: Property hprop_golden_shelleyAddressBuild = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - addressVKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/verification_key" - addressSKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/verification_key" - goldenStakingAddressHexFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/addresses/staking-address.hex" - goldenEnterpriseAddressHexFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/addresses/enterprise-address.hex" + addressVKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/payment_keys/verification_key" + addressSKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/verification_key" + goldenStakingAddressHexFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/addresses/staking-address.hex" + goldenEnterpriseAddressHexFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/addresses/enterprise-address.hex" stakingAddressHexFile <- noteTempFile tempDir "staking-address.hex" enterpriseAddressHexFile <- noteTempFile tempDir "enterprise-address.hex" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/Create.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/Create.hs index edb7c7fdb9..183e342fef 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/Create.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/Create.hs @@ -68,9 +68,9 @@ parseTotalSupply = J.withObject "Object" $ \ o -> do hprop_golden_shelleyGenesisCreate :: Property hprop_golden_shelleyGenesisCreate = propertyOnce $ do H.moduleWorkspace "tmp" $ \tempDir -> do - sourceGenesisSpecFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/genesis/genesis.spec.json" - sourceAlonzoGenesisSpecFile <- noteInputFile "test/cardano-cli-golden/files/golden/alonzo/genesis.alonzo.spec.json" - sourceConwayGenesisSpecFile <- noteInputFile "test/cardano-cli-golden/files/golden/conway/genesis.conway.spec.json" + sourceGenesisSpecFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/genesis/genesis.spec.json" + sourceAlonzoGenesisSpecFile <- noteInputFile "test/cardano-cli-golden/files/input/alonzo/genesis.alonzo.spec.json" + sourceConwayGenesisSpecFile <- noteInputFile "test/cardano-cli-golden/files/input/conway/genesis.conway.spec.json" genesisSpecFile <- noteTempFile tempDir "genesis.spec.json" alonzoSpecFile <- noteTempFile tempDir "genesis.alonzo.spec.json" @@ -160,11 +160,11 @@ hprop_golden_shelleyGenesisCreate = propertyOnce $ do (delegateCount, fmtDelegateCount) <- fmap (OP.withSnd show) $ forAll $ G.int (R.linear 4 19) (utxoCount, fmtUtxoCount) <- fmap (OP.withSnd show) $ forAll $ G.int (R.linear 4 19) - sourceAlonzoGenesisSpecFile <- noteInputFile "test/cardano-cli-golden/files/golden/alonzo/genesis.alonzo.spec.json" + sourceAlonzoGenesisSpecFile <- noteInputFile "test/cardano-cli-golden/files/input/alonzo/genesis.alonzo.spec.json" alonzoSpecFile <- noteTempFile tempDir "genesis.alonzo.spec.json" H.copyFile sourceAlonzoGenesisSpecFile alonzoSpecFile - sourceConwayGenesisSpecFile <- noteInputFile "test/cardano-cli-golden/files/golden/conway/genesis.conway.spec.json" + sourceConwayGenesisSpecFile <- noteInputFile "test/cardano-cli-golden/files/input/conway/genesis.conway.spec.json" conwaySpecFile <- noteTempFile tempDir "genesis.conway.spec.json" H.copyFile sourceConwayGenesisSpecFile conwaySpecFile 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 b5f0bfff25..316d7f8726 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,25 +5,18 @@ module Test.Golden.Shelley.Genesis.InitialTxIn where import Test.Cardano.CLI.Util import Hedgehog (Property) -import qualified Hedgehog.Extras.Test.Base as H -import qualified Hedgehog.Extras.Test.File as H +import qualified Hedgehog.Extras.Test.Golden as H {- HLINT ignore "Use camelCase" -} hprop_golden_shelleyGenesisInitialTxIn :: Property -hprop_golden_shelleyGenesisInitialTxIn = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - verificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_verification_keys/genesis-utxo.vkey" +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" - utxoHashFile <- noteTempFile tempDir "utxo_hash" - utxoHash <- execCardanoCLI [ "genesis","initial-txin" , "--testnet-magic", "16" , "--verification-key-file", verificationKeyFile ] - H.writeFile utxoHashFile utxoHash - - goldenUtxoHash <- H.readFile goldenUtxoHashFile - - equivalence utxoHash goldenUtxoHash + H.diffVsGoldenFile utxoHash goldenUtxoHashFile diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/KeyHash.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/KeyHash.hs index bb2cf4d3ba..31cb5d12a9 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/KeyHash.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/KeyHash.hs @@ -12,8 +12,8 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyGenesisKeyHash :: Property hprop_golden_shelleyGenesisKeyHash = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - referenceVerificationKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/verification_key" - goldenGenesisVerificationKeyHashFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/verification_key.key-hash" + referenceVerificationKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key" + goldenGenesisVerificationKeyHashFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key.key-hash" genesisVerificationKeyHashFile <- noteTempFile tempDir "key-hash.hex" genesisVerificationKeyHash <- execCardanoCLI diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Key/ConvertCardanoAddressKey.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Key/ConvertCardanoAddressKey.hs index e0ed82818b..b36682fed3 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Key/ConvertCardanoAddressKey.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Key/ConvertCardanoAddressKey.hs @@ -7,9 +7,10 @@ import Data.Text (Text) import Test.Cardano.CLI.Util -import Hedgehog (Property, (===)) +import Hedgehog (Property) import qualified Hedgehog.Extras.Test.Base as H import qualified Hedgehog.Extras.Test.File as H +import qualified Hedgehog.Extras.Test.Golden as H {- HLINT ignore "Use camelCase" -} @@ -67,12 +68,8 @@ hprop_golden_convertCardanoAddressByronSigningKey = -- Check that the contents of the converted signing key file match that of -- the golden file. - actualConvertedSigningKey <- H.readFile convertedSigningKeyFp - expectedConvertedSigningKey <- - H.readFile $ - "test/cardano-cli-golden/files/golden/shelley/keys/converted_cardano-address_keys/" - <> "byron_signing_key" - expectedConvertedSigningKey === actualConvertedSigningKey + H.diffFileVsGoldenFile convertedSigningKeyFp + "test/cardano-cli-golden/files/golden/shelley/keys/converted_cardano-address_keys/byron_signing_key" -- | Test that converting a @cardano-address@ Icarus signing key yields the -- expected result. @@ -104,12 +101,8 @@ hprop_golden_convertCardanoAddressIcarusSigningKey = -- Check that the contents of the converted signing key file match that of -- the golden file. - actualConvertedSigningKey <- H.readFile convertedSigningKeyFp - expectedConvertedSigningKey <- - H.readFile $ - "test/cardano-cli-golden/files/golden/shelley/keys/converted_cardano-address_keys/" - <> "icarus_signing_key" - expectedConvertedSigningKey === actualConvertedSigningKey + H.diffFileVsGoldenFile convertedSigningKeyFp + "test/cardano-cli-golden/files/golden/shelley/keys/converted_cardano-address_keys/icarus_signing_key" -- | Test that converting a @cardano-address@ Shelley payment signing key -- yields the expected result. @@ -142,12 +135,8 @@ hprop_golden_convertCardanoAddressShelleyPaymentSigningKey = -- Check that the contents of the converted signing key file match that of -- the golden file. - actualConvertedSigningKey <- H.readFile convertedSigningKeyFp - expectedConvertedSigningKey <- - H.readFile $ - "test/cardano-cli-golden/files/golden/shelley/keys/converted_cardano-address_keys/" - <> "shelley_payment_signing_key" - expectedConvertedSigningKey === actualConvertedSigningKey + H.diffFileVsGoldenFile convertedSigningKeyFp + "test/cardano-cli-golden/files/golden/shelley/keys/converted_cardano-address_keys/shelley_payment_signing_key" -- | Test that converting a @cardano-address@ Shelley stake signing key yields -- the expected result. @@ -180,9 +169,5 @@ hprop_golden_convertCardanoAddressShelleyStakeSigningKey = -- Check that the contents of the converted signing key file match that of -- the golden file. - actualConvertedSigningKey <- H.readFile convertedSigningKeyFp - expectedConvertedSigningKey <- - H.readFile $ - "test/cardano-cli-golden/files/golden/shelley/keys/converted_cardano-address_keys/" - <> "shelley_stake_signing_key" - expectedConvertedSigningKey === actualConvertedSigningKey + H.diffFileVsGoldenFile convertedSigningKeyFp + "test/cardano-cli-golden/files/golden/shelley/keys/converted_cardano-address_keys/shelley_stake_signing_key" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Metadata/StakePoolMetadata.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Metadata/StakePoolMetadata.hs index 417481ebbd..ea90dbb66d 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Metadata/StakePoolMetadata.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Metadata/StakePoolMetadata.hs @@ -17,7 +17,7 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_stakePoolMetadataHash :: Property hprop_golden_stakePoolMetadataHash = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - referenceStakePoolMetadata <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/metadata/stake_pool_metadata_hash" + referenceStakePoolMetadata <- noteInputFile "test/cardano-cli-golden/files/input/shelley/metadata/stake_pool_metadata_hash" stakePoolMetadataFile <- noteTempFile tempDir "stake-pool-metadata.json" outputStakePoolMetadataHashFp <- noteTempFile tempDir "stake-pool-metadata-hash.txt" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/MultiSig/Address.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/MultiSig/Address.hs index c50f222902..dda7b39117 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/MultiSig/Address.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/MultiSig/Address.hs @@ -7,12 +7,13 @@ import Test.Cardano.CLI.Util as OP import Hedgehog (Property) import qualified Hedgehog.Extras.Test.Base as H import qualified Hedgehog.Extras.Test.File as H +import qualified Hedgehog.Extras.Test.Golden as H {- HLINT ignore "Use camelCase" -} hprop_golden_shelleyAllMultiSigAddressBuild :: Property hprop_golden_shelleyAllMultiSigAddressBuild = propertyOnce . H.moduleWorkspace "tmp" $ \_ -> do - allMultiSigFp <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/multisig/scripts/all" + allMultiSigFp <- noteInputFile "test/cardano-cli-golden/files/input/shelley/multisig/scripts/all" allMultiSigAddress <- execCardanoCLI [ "address", "build" @@ -20,7 +21,7 @@ hprop_golden_shelleyAllMultiSigAddressBuild = propertyOnce . H.moduleWorkspace " , "--mainnet" ] - goldenAllMultiSigAddrFp <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/multisig/addresses/all" + goldenAllMultiSigAddrFp <- noteInputFile "test/cardano-cli-golden/files/input/shelley/multisig/addresses/all" goldenAllMs <- H.readFile goldenAllMultiSigAddrFp @@ -28,7 +29,7 @@ hprop_golden_shelleyAllMultiSigAddressBuild = propertyOnce . H.moduleWorkspace " hprop_golden_shelleyAnyMultiSigAddressBuild :: Property hprop_golden_shelleyAnyMultiSigAddressBuild = propertyOnce . H.moduleWorkspace "tmp" $ \_ -> do - anyMultiSigFp <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/multisig/scripts/any" + anyMultiSigFp <- noteInputFile "test/cardano-cli-golden/files/input/shelley/multisig/scripts/any" anyMultiSigAddress <- execCardanoCLI [ "address", "build" @@ -36,7 +37,7 @@ hprop_golden_shelleyAnyMultiSigAddressBuild = propertyOnce . H.moduleWorkspace " , "--mainnet" ] - goldenAnyMultiSigAddrFp <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/multisig/addresses/any" + goldenAnyMultiSigAddrFp <- noteInputFile "test/cardano-cli-golden/files/input/shelley/multisig/addresses/any" goldenAnyMs <- H.readFile goldenAnyMultiSigAddrFp @@ -44,7 +45,7 @@ hprop_golden_shelleyAnyMultiSigAddressBuild = propertyOnce . H.moduleWorkspace " hprop_golden_shelleyAtLeastMultiSigAddressBuild :: Property hprop_golden_shelleyAtLeastMultiSigAddressBuild = propertyOnce . H.moduleWorkspace "tmp" $ \_ -> do - atLeastMultiSigFp <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/multisig/scripts/atleast" + atLeastMultiSigFp <- noteInputFile "test/cardano-cli-golden/files/input/shelley/multisig/scripts/atleast" atLeastMultiSigAddress <- execCardanoCLI [ "address", "build" @@ -52,8 +53,6 @@ hprop_golden_shelleyAtLeastMultiSigAddressBuild = propertyOnce . H.moduleWorkspa , "--mainnet" ] - goldenAtLeastMultiSigAddrFp <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/multisig/addresses/atleast" + goldenAtLeastMultiSigAddrFp <- H.note "test/cardano-cli-golden/files/golden/shelley/multisig/addresses/atleast" - goldenAtLeastMs <- H.readFile goldenAtLeastMultiSigAddrFp - - equivalence atLeastMultiSigAddress goldenAtLeastMs + H.diffVsGoldenFile atLeastMultiSigAddress goldenAtLeastMultiSigAddrFp diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/IssueOpCert.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/IssueOpCert.hs index 81db1680ef..faadd0e372 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/IssueOpCert.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/IssueOpCert.hs @@ -14,9 +14,9 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyNodeIssueOpCert :: Property hprop_golden_shelleyNodeIssueOpCert = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - hotKesVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/kes_keys/verification_key" - coldSigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/signing_key" - originalOperationalCertificateIssueCounterFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/operational_certificate_counter" + hotKesVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/kes_keys/verification_key" + coldSigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/signing_key" + originalOperationalCertificateIssueCounterFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/operational_certificate_counter" operationalCertificateIssueCounterFile <- noteTempFile tempDir "delegate-op-cert.counter" operationalCertFile <- noteTempFile tempDir "operational.cert" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/Build.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/Build.hs index 7f853cd5a4..6babfa43d7 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/Build.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/Build.hs @@ -12,8 +12,8 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyStakeAddressBuild :: Property hprop_golden_shelleyStakeAddressBuild = propertyOnce . H.moduleWorkspace "tmp" $ \_ -> do - verificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/verification_key" - goldenRewardAddressFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/reward_address" + verificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/verification_key" + goldenRewardAddressFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/reward_address" rewardAddress <- execCardanoCLI [ "stake-address","build" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/DeregistrationCertificate.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/DeregistrationCertificate.hs index f9e4772b2d..1196bbc34c 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/DeregistrationCertificate.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/DeregistrationCertificate.hs @@ -18,7 +18,7 @@ hprop_golden_shelleyStakeAddressDeregistrationCertificate :: Property hprop_golden_shelleyStakeAddressDeregistrationCertificate = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do base <- H.getProjectBase - verificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/verification_key" + verificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/verification_key" deregistrationCertFile <- noteTempFile tempDir "deregistrationCertFile" scriptDeregistrationCertFile <- noteTempFile tempDir "scripDeregistrationCertFile" exampleScript <- noteInputFile $ base "scripts/plutus/scripts/v1/custom-guess-42-datum-42.plutus" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/RegistrationCertificate.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/RegistrationCertificate.hs index 749c8681a1..03f93799c5 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/RegistrationCertificate.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakeAddress/RegistrationCertificate.hs @@ -18,7 +18,7 @@ hprop_golden_shelleyStakeAddressRegistrationCertificate :: Property hprop_golden_shelleyStakeAddressRegistrationCertificate = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do base <- H.getProjectBase - keyGenStakingVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/verification_key" + keyGenStakingVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/verification_key" registrationCertFile <- noteTempFile tempDir "registration.cert" scriptRegistrationCertFile <- noteTempFile tempDir "script-registration.cert" exampleScript <- noteInputFile $ base "scripts/plutus/scripts/v1/custom-guess-42-datum-42.plutus" @@ -43,7 +43,7 @@ hprop_golden_shelleyStakeAddressRegistrationCertificate = propertyOnce . H.modul hprop_golden_shelleyStakeAddressRegistrationCertificateWithBuildRaw :: Property hprop_golden_shelleyStakeAddressRegistrationCertificateWithBuildRaw = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - keyGenStakingVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/verification_key" + keyGenStakingVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/verification_key" registrationCertFile <- noteTempFile tempDir "registration.cert" txRawFile <- noteTempFile tempDir "tx.raw" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakePool/RegistrationCertificate.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakePool/RegistrationCertificate.hs index b8c4053235..198977dbf3 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakePool/RegistrationCertificate.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakePool/RegistrationCertificate.hs @@ -14,9 +14,9 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyStakePoolRegistrationCertificate :: Property hprop_golden_shelleyStakePoolRegistrationCertificate = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - operatorVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/node-pool/operator.vkey" - vrfVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/node-pool/vrf.vkey" - ownerVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/node-pool/owner.vkey" + operatorVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/operator.vkey" + vrfVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/vrf.vkey" + ownerVerificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/owner.vkey" registrationCertFile <- noteTempFile tempDir "registration.cert" void $ execCardanoCLI diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/GenesisKeyDelegation.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/GenesisKeyDelegation.hs index 4921794f3e..bf64985644 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/GenesisKeyDelegation.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/GenesisKeyDelegation.hs @@ -23,7 +23,7 @@ hprop_golden_shelleyGenesisKeyDelegationCertificate = -- Reference certificate referenceCertificateFilePath <- noteInputFile $ - "test/cardano-cli-golden/files/golden/shelley/certificates/" + "test/cardano-cli-golden/files/input/shelley/certificates/" <> "genesis_key_delegation_certificate" -- Verification key and certificate filepaths diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/MIR.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/MIR.hs index e7462cf189..37a05d37b6 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/MIR.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/MIR.hs @@ -22,7 +22,7 @@ hprop_golden_shelleyMIRCertificate = propertyOnce . H.moduleWorkspace "tmp" $ \t let era = BabbageEra -- Reference keys - referenceMIRCertificate <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/certificates/mir_certificate" + referenceMIRCertificate <- noteInputFile "test/cardano-cli-golden/files/input/shelley/certificates/mir_certificate" -- Key filepaths verKey <- noteTempFile tempDir "stake-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/Operational.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/Operational.hs index 7bfdd8504b..889de72520 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/Operational.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/Operational.hs @@ -21,7 +21,7 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyOperationalCertificate :: Property hprop_golden_shelleyOperationalCertificate = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceOperationalCertificate <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/certificates/operational_certificate" + referenceOperationalCertificate <- noteInputFile "test/cardano-cli-golden/files/input/shelley/certificates/operational_certificate" -- Key filepaths kesVerKey <- noteTempFile tempDir "KES-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/StakeAddress.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/StakeAddress.hs index b7e37e30df..0d728bae01 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/StakeAddress.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/StakeAddress.hs @@ -22,10 +22,10 @@ hprop_golden_shelleyStakeAddressCertificates = propertyOnce . H.moduleWorkspace let era = BabbageEra -- Reference files - referenceRegistrationCertificate <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/certificates/stake_address_registration_certificate" - referenceDeregistrationCertificate <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/certificates/stake_address_deregistration_certificate" - referenceDelegationCertificate <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/certificates/stake_address_delegation_certificate" - operatorVkey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/node-pool/operator.vkey" + referenceRegistrationCertificate <- noteInputFile "test/cardano-cli-golden/files/input/shelley/certificates/stake_address_registration_certificate" + referenceDeregistrationCertificate <- noteInputFile "test/cardano-cli-golden/files/input/shelley/certificates/stake_address_deregistration_certificate" + referenceDelegationCertificate <- noteInputFile "test/cardano-cli-golden/files/input/shelley/certificates/stake_address_delegation_certificate" + operatorVkey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/operator.vkey" -- Key filepaths verKey <- noteTempFile tempDir "stake-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/StakePool.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/StakePool.hs index 21a449c323..0e2e6b0945 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/StakePool.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/StakePool.hs @@ -26,8 +26,8 @@ hprop_golden_shelleyStakePoolCertificates = propertyOnce . H.moduleWorkspace "tm let era = BabbageEra -- TODO generate for all eras -- Reference files - referenceRegistrationCertificate <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/certificates/stake_pool_registration_certificate" - referenceDeregistrationCertificate <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/certificates/stake_pool_deregistration_certificate" + referenceRegistrationCertificate <- noteInputFile "test/cardano-cli-golden/files/input/shelley/certificates/stake_pool_registration_certificate" + referenceDeregistrationCertificate <- noteInputFile "test/cardano-cli-golden/files/input/shelley/certificates/stake_pool_deregistration_certificate" -- Key filepaths coldVerKey <- noteTempFile tempDir "cold-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/ExtendedPaymentKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/ExtendedPaymentKeys.hs index 18af05230b..2630d07d47 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/ExtendedPaymentKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/ExtendedPaymentKeys.hs @@ -23,8 +23,8 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyExtendedPaymentKeys :: Property hprop_golden_shelleyExtendedPaymentKeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/extended_payment_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/extended_payment_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/extended_payment_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/extended_payment_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "extended-payment-verification-key-file" @@ -52,8 +52,8 @@ hprop_golden_shelleyExtendedPaymentKeys = propertyOnce . H.moduleWorkspace "tmp" hprop_golden_shelleyExtendedPaymentKeys_te :: Property hprop_golden_shelleyExtendedPaymentKeys_te = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/extended_payment_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/extended_payment_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/extended_payment_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/extended_payment_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "extended-payment-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisDelegateKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisDelegateKeys.hs index 97073b1544..816b7222ef 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisDelegateKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisDelegateKeys.hs @@ -19,9 +19,9 @@ import qualified Hedgehog.Extras.Test.Base as H hprop_golden_shelleyGenesisDelegateKeys :: Property hprop_golden_shelleyGenesisDelegateKeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/signing_key" - referenceOpCertCounter <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/operational_certificate_counter" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/signing_key" + referenceOpCertCounter <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/operational_certificate_counter" -- Key filepaths verKey <- noteTempFile tempDir "genesis-delegate-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisKeys.hs index d1a903ad69..819e77356c 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisKeys.hs @@ -19,8 +19,8 @@ import qualified Hedgehog.Extras.Test.Base as H hprop_golden_shelleyGenesisKeys :: Property hprop_golden_shelleyGenesisKeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "genesis-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisUTxOKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisUTxOKeys.hs index 9d5d389036..ba1fea089a 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisUTxOKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisUTxOKeys.hs @@ -19,8 +19,8 @@ import qualified Hedgehog.Extras.Test.Base as H hprop_golden_shelleyGenesisUTxOKeys :: Property hprop_golden_shelleyGenesisUTxOKeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_utxo_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_utxo_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_utxo_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_utxo_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "genesis-utxo-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/KESKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/KESKeys.hs index 12f875b20d..c1ba9d855d 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/KESKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/KESKeys.hs @@ -23,8 +23,8 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyKESKeys :: Property hprop_golden_shelleyKESKeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/kes_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/kes_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/kes_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/kes_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "kes-verification-key-file" @@ -51,8 +51,8 @@ hprop_golden_shelleyKESKeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir hprop_golden_shelleyKESKeys_te :: Property hprop_golden_shelleyKESKeys_te = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/kes_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/kes_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/kes_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/kes_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "kes-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/PaymentKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/PaymentKeys.hs index 320de4a478..4912e9ec33 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/PaymentKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/PaymentKeys.hs @@ -23,8 +23,8 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyPaymentKeys :: Property hprop_golden_shelleyPaymentKeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/payment_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/payment_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "payment-verification-key-file" @@ -51,8 +51,8 @@ hprop_golden_shelleyPaymentKeys = propertyOnce . H.moduleWorkspace "tmp" $ \temp hprop_golden_shelleyPaymentKeys_te :: Property hprop_golden_shelleyPaymentKeys_te = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/payment_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/payment_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "payment-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/StakeKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/StakeKeys.hs index 7f325175dc..0954c27197 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/StakeKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/StakeKeys.hs @@ -23,8 +23,8 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyStakeKeys :: Property hprop_golden_shelleyStakeKeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "stake-verification-key-file" @@ -51,8 +51,8 @@ hprop_golden_shelleyStakeKeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDi hprop_golden_shelleyStakeKeys_te :: Property hprop_golden_shelleyStakeKeys_te = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "stake-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/VRFKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/VRFKeys.hs index d99ec931bf..1bd1027b6c 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/VRFKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/VRFKeys.hs @@ -25,8 +25,8 @@ hprop_golden_shelleyVRFKeys = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir H.note_ tempDir -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/vrf_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/vrf_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/vrf_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/vrf_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "vrf-verification-key-file" @@ -55,8 +55,8 @@ hprop_golden_shelleyVRFKeys_te = propertyOnce . H.moduleWorkspace "tmp" $ \tempD H.note_ tempDir -- Reference keys - referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/vrf_keys/verification_key" - referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/vrf_keys/signing_key" + referenceVerKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/vrf_keys/verification_key" + referenceSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/vrf_keys/signing_key" -- Key filepaths verKey <- noteTempFile tempDir "vrf-verification-key-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Tx/Tx.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Tx/Tx.hs index aeb44d813f..a7c6c0b832 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Tx/Tx.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Tx/Tx.hs @@ -18,10 +18,10 @@ import qualified Hedgehog.Extras.Test.Base as H hprop_golden_shelleyTx :: Property hprop_golden_shelleyTx = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - let referenceTx = "test/cardano-cli-golden/files/golden/alonzo/tx" + let goldenReferenceTx = "test/cardano-cli-golden/files/golden/alonzo/tx" -- Key filepaths - paymentSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/transaction-sign/utxo.skey" + paymentSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/transaction-sign/utxo.skey" transactionFile <- noteTempFile tempDir "tx-file" transactionBodyFile <- noteTempFile tempDir "tx-body-file" @@ -46,7 +46,7 @@ hprop_golden_shelleyTx = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Check the newly created files have not deviated from the -- golden files - checkTxCddlFormat referenceTx transactionFile + checkTxCddlFormat goldenReferenceTx transactionFile -- TODO Re-enable this test disable_hprop_golden_checkIfConstitutionalCommitteeKeyCanSign :: Property @@ -55,9 +55,9 @@ disable_hprop_golden_checkIfConstitutionalCommitteeKeyCanSign = propertyOnce . H let referenceTx = "test/cardano-cli-golden/files/input/conway/tx" -- Key filepaths - paymentSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/transaction-sign/utxo.skey" + paymentSignKey <- noteInputFile "test/cardano-cli-golden/files/input/shelley/transaction-sign/utxo.skey" -- constitutional committee signing key - paymentSignKey2 <- noteInputFile "test/cardano-cli-golden/files/golden/conway/cold1-cc.skey" + paymentSignKey2 <- noteInputFile "test/cardano-cli-golden/files/input/conway/cold1-cc.skey" transactionFile <- noteTempFile tempDir "tx-file" transactionBodyFile <- noteTempFile tempDir "tx-body-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Tx/TxBody.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Tx/TxBody.hs index 4bc202e347..c1902d6774 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Tx/TxBody.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Tx/TxBody.hs @@ -16,7 +16,7 @@ import qualified Hedgehog.Extras.Test.Base as H hprop_golden_shelleyTxBody :: Property hprop_golden_shelleyTxBody = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do -- Reference keys - referenceTxBody <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/tx/txbody" + referenceTxBody <- noteInputFile "test/cardano-cli-golden/files/input/shelley/tx/txbody" -- Key filepaths transactionBodyFile <- noteTempFile tempDir "transaction-body-file" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextView/DecodeCbor.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextView/DecodeCbor.hs index 0a98e41d7f..a8479d2b25 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextView/DecodeCbor.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextView/DecodeCbor.hs @@ -12,7 +12,7 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyTextViewDecodeCbor :: Property hprop_golden_shelleyTextViewDecodeCbor = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - unsignedTxFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/tx/unsigned.tx" + unsignedTxFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/tx/unsigned.tx" decodedTxtFile <- noteTempFile tempDir "decoded.txt" -- Defaults to signing a Mainnet transaction. diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Assemble.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Assemble.hs index ed5194cb5e..4e69c3822c 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Assemble.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Assemble.hs @@ -17,8 +17,8 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyTransactionAssembleWitness_SigningKey :: Property hprop_golden_shelleyTransactionAssembleWitness_SigningKey = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do witnessTx <- noteTempFile tempDir "single-signing-key-witness-tx" - txBodyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/tx/txbody" - signingKeyWitnessFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/witnesses/singleSigningKeyWitness" + txBodyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/tx/txbody" + signingKeyWitnessFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/witnesses/singleSigningKeyWitness" void $ execCardanoCLI [ "transaction","sign-witness" , "--tx-body-file", txBodyFile diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Build.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Build.hs index b3e75dc920..bf67639af0 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Build.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Build.hs @@ -42,8 +42,8 @@ hprop_golden_shelleyTransactionBuild = hprop_golden_shelleyTransactionBuild_CertificateScriptWitnessed :: Property hprop_golden_shelleyTransactionBuild_CertificateScriptWitnessed = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - let deregcert = "test/cardano-cli-golden/files/golden/shelley/certificates/stake_address_deregistration_certificate" - scriptWit = "test/cardano-cli-golden/files/golden/shelley/multisig/scripts/any" + let deregcert = "test/cardano-cli-golden/files/input/shelley/certificates/stake_address_deregistration_certificate" + scriptWit = "test/cardano-cli-golden/files/input/shelley/multisig/scripts/any" txBodyOutFile <- noteTempFile tempDir "tx-body-out" @@ -63,7 +63,7 @@ hprop_golden_shelleyTransactionBuild_CertificateScriptWitnessed = hprop_golden_shelleyTransactionBuild_Minting :: Property hprop_golden_shelleyTransactionBuild_Minting = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - let scriptWit = "test/cardano-cli-golden/files/golden/shelley/multisig/scripts/any" + let scriptWit = "test/cardano-cli-golden/files/input/shelley/multisig/scripts/any" polid <- execCardanoCLI [ "transaction" @@ -96,10 +96,10 @@ hprop_golden_shelleyTransactionBuild_WithdrawalScriptWitnessed = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do txBodyOutFile <- noteTempFile tempDir "tx-body-out" - stakeAddress <- H.readFile "test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/reward_address" + stakeAddress <- H.readFile "test/cardano-cli-golden/files/input/shelley/keys/stake_keys/reward_address" let withdrawal = filter (/= '\n') $ stakeAddress <> "+100" - scriptWit = "test/cardano-cli-golden/files/golden/shelley/multisig/scripts/any" + scriptWit = "test/cardano-cli-golden/files/input/shelley/multisig/scripts/any" void $ execCardanoCLI [ "mary", "transaction", "build-raw" @@ -117,7 +117,7 @@ hprop_golden_shelleyTransactionBuild_WithdrawalScriptWitnessed = hprop_golden_shelleyTransactionBuild_TxInScriptWitnessed :: Property hprop_golden_shelleyTransactionBuild_TxInScriptWitnessed = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - let scriptWit = "test/cardano-cli-golden/files/golden/shelley/multisig/scripts/any" + let scriptWit = "test/cardano-cli-golden/files/input/shelley/multisig/scripts/any" txBodyOutFile <- noteTempFile tempDir "tx-body-out" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/CalculateMinFee.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/CalculateMinFee.hs index 1e89d6f739..c0f741dd31 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/CalculateMinFee.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/CalculateMinFee.hs @@ -13,8 +13,8 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyTransactionCalculateMinFee :: Property hprop_golden_shelleyTransactionCalculateMinFee = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - protocolParamsJsonFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/transaction-calculate-min-fee/protocol-params.json" - txBodyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/tx/txbody" + protocolParamsJsonFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/transaction-calculate-min-fee/protocol-params.json" + txBodyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/tx/txbody" minFeeTxtFile <- noteTempFile tempDir "min-fee.txt" minFeeTxt <- execCardanoCLI diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/CreateWitness.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/CreateWitness.hs index 4fa21615e3..fc48d92236 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/CreateWitness.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/CreateWitness.hs @@ -34,7 +34,7 @@ hprop_golden_shelleyTransactionSigningKeyWitness = propertyOnce $ H.moduleWorksp -- Create all multisig witness witnessOutFile <- noteTempFile tempDir "signingkey-witness" - signingKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/signing_key" + signingKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/payment_keys/signing_key" void $ execCardanoCLI [ "transaction","witness" , "--tx-body-file", txBodyOutFile diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Sign.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Sign.hs index 50092ce48f..3d51e7290b 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Sign.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Transaction/Sign.hs @@ -14,11 +14,11 @@ import qualified Hedgehog.Extras.Test.File as H hprop_golden_shelleyTransactionSign :: Property hprop_golden_shelleyTransactionSign = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - txBodyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/tx/txbody" - initialUtxo1SigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/signing_key" - utxoSigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/transaction-sign/utxo.skey" - stakeSigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/transaction-sign/stake.skey" - nodeColdSigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/transaction-sign/node-cold.skey" + txBodyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/tx/txbody" + initialUtxo1SigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/payment_keys/signing_key" + utxoSigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/transaction-sign/utxo.skey" + stakeSigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/transaction-sign/stake.skey" + nodeColdSigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/transaction-sign/node-cold.skey" signedTransactionFile <- noteTempFile tempDir "signed.tx" transactionPoolRegSignedFile <- noteTempFile tempDir "tx-pool-reg.signed" diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/TxView.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/TxView.hs index e29be1ff45..e7e3c88aab 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/TxView.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/TxView.hs @@ -46,7 +46,7 @@ hprop_golden_view_byron = hprop_golden_view_shelley :: Property hprop_golden_view_shelley = let - certDir = "test/cardano-cli-golden/files/golden/shelley/certificates" + certDir = "test/cardano-cli-golden/files/input/shelley/certificates" certs = (certDir ) <$> [ "genesis_key_delegation_certificate" @@ -82,7 +82,7 @@ hprop_golden_view_shelley = let , "--epoch", "64" , "--extra-entropy", extraEntropySeed , "--genesis-verification-key-file" - , "test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/verification_key" + , "test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key" , "--key-reg-deposit-amt", "71" , "--max-block-body-size", "72" , "--max-block-header-size", "73" @@ -124,6 +124,7 @@ hprop_golden_view_shelley = let result <- execCardanoCLI ["transaction", "view", "--tx-body-file", transactionBodyFile] + H.diffVsGoldenFile result "test/cardano-cli-golden/files/golden/shelley/transaction-view.out" hprop_golden_view_allegra :: Property @@ -212,8 +213,8 @@ hprop_golden_view_mary = , " a06ee5ffdd7f9b5bd992eb9543f44418323f81229526b77b0e4be067" , ".736b79" ] - , "--mint-script-file", "test/cardano-cli-golden/files/golden/mary/scripts/mint.all" - , "--mint-script-file", "test/cardano-cli-golden/files/golden/mary/scripts/mint.sig" + , "--mint-script-file", "test/cardano-cli-golden/files/input/mary/scripts/mint.all" + , "--mint-script-file", "test/cardano-cli-golden/files/input/mary/scripts/mint.sig" , "--out-file", transactionBodyFile ] @@ -246,8 +247,7 @@ createAlonzoTxBody mUpdateProposalFile transactionBodyFile = do hprop_golden_view_alonzo :: Property hprop_golden_view_alonzo = - propertyOnce $ - moduleWorkspace "tmp" $ \tempDir -> do + propertyOnce $ moduleWorkspace "tmp" $ \tempDir -> do updateProposalFile <- noteTempFile tempDir "update-proposal" transactionBodyFile <- noteTempFile tempDir "transaction-body" @@ -262,7 +262,7 @@ hprop_golden_view_alonzo = [ "legacy", "governance", "create-update-proposal" , "--epoch", "190" , "--genesis-verification-key-file" - , "test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/verification_key" + , "test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key" , "--utxo-cost-per-word", "194" , "--price-execution-steps", "195/196" , "--price-execution-memory", "196/197" @@ -284,26 +284,27 @@ hprop_golden_view_alonzo = hprop_golden_view_alonzo_signed :: Property hprop_golden_view_alonzo_signed = - let testData = "test/cardano-cli-golden/files/golden/alonzo" - in - propertyOnce $ - moduleWorkspace "tmp" $ \tempDir -> do - transactionBodyFile <- noteTempFile tempDir "transaction-body" - transactionFile <- noteTempFile tempDir "transaction" + propertyOnce $ moduleWorkspace "tmp" $ \tempDir -> do + let golden = "test/cardano-cli-golden/files/golden/alonzo" + let input = "test/cardano-cli-golden/files/input/alonzo" - createAlonzoTxBody Nothing transactionBodyFile + transactionBodyFile <- noteTempFile tempDir "transaction-body" + transactionFile <- noteTempFile tempDir "transaction" - -- Sign - void $ - execCardanoCLI - [ "transaction", "sign" - , "--tx-body-file", transactionBodyFile - , "--signing-key-file", testData "signing.key" - , "--out-file", transactionFile - ] + createAlonzoTxBody Nothing transactionBodyFile - -- View transaction body - result <- - execCardanoCLI - ["transaction", "view", "--tx-file", transactionFile] - H.diffVsGoldenFile result (testData "signed-transaction-view.out") + -- Sign + void $ + execCardanoCLI + [ "transaction", "sign" + , "--tx-body-file", transactionBodyFile + , "--signing-key-file", input "signing.key" + , "--out-file", transactionFile + ] + + -- View transaction body + result <- + execCardanoCLI + ["transaction", "view", "--tx-file", transactionFile] + + H.diffVsGoldenFile result (golden "signed-transaction-view.out") diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/tx b/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/tx index edce62bab2..4ca8a23be1 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/tx +++ b/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/tx @@ -2,4 +2,4 @@ "type": "Witnessed Tx AlonzoEra", "description": "Ledger Cddl Format", "cborHex": "84a30081825820f62cd7bc15d8c6d2c8519fb8d13c57c0157ab6bab50af62bc63706feb966393d0001828258390076619da7963eaa588252c45e960667a4647eed69135f51f5a10f2888d2c20ac07056fc8899c47d825cefd9dcf5efba150236e043262e2b431b0000011764f7be0782581d604088059bbeb6add02eecd0c6a2a52c06910f2a6b4ba0029e9fe6ed131a00989680021a00028b79a100818258208dc60533b5dfa60a530955a696323a2ef4f14e8bc95a8f84cf6c441fea4234275840043220211a264209f6e61903e60e80093b7b3a08e8bc5fe8f8707635acd69b6e0589e61aea544b87729983955decded90a59f9701042bebe57f2afba7c94fc02f5f6" -} \ No newline at end of file +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/genesis.alonzo.spec.json b/cardano-cli/test/cardano-cli-golden/files/input/alonzo/genesis.alonzo.spec.json similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/alonzo/genesis.alonzo.spec.json rename to cardano-cli/test/cardano-cli-golden/files/input/alonzo/genesis.alonzo.spec.json diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/signing.key b/cardano-cli/test/cardano-cli-golden/files/input/alonzo/signing.key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/alonzo/signing.key rename to cardano-cli/test/cardano-cli-golden/files/input/alonzo/signing.key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/byron/keys/byron.skey b/cardano-cli/test/cardano-cli-golden/files/input/byron/keys/byron.skey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/byron/keys/byron.skey rename to cardano-cli/test/cardano-cli-golden/files/input/byron/keys/byron.skey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/byron/keys/legacy.skey b/cardano-cli/test/cardano-cli-golden/files/input/byron/keys/legacy.skey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/byron/keys/legacy.skey rename to cardano-cli/test/cardano-cli-golden/files/input/byron/keys/legacy.skey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/byron/tx/legacy.tx b/cardano-cli/test/cardano-cli-golden/files/input/byron/tx/legacy.tx similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/byron/tx/legacy.tx rename to cardano-cli/test/cardano-cli-golden/files/input/byron/tx/legacy.tx diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/byron/tx/normal.tx b/cardano-cli/test/cardano-cli-golden/files/input/byron/tx/normal.tx similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/byron/tx/normal.tx rename to cardano-cli/test/cardano-cli-golden/files/input/byron/tx/normal.tx diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/byron/update-proposal b/cardano-cli/test/cardano-cli-golden/files/input/byron/update-proposal similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/byron/update-proposal rename to cardano-cli/test/cardano-cli-golden/files/input/byron/update-proposal diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/byron/votes/vote-no b/cardano-cli/test/cardano-cli-golden/files/input/byron/votes/vote-no similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/byron/votes/vote-no rename to cardano-cli/test/cardano-cli-golden/files/input/byron/votes/vote-no diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/byron/votes/vote-yes b/cardano-cli/test/cardano-cli-golden/files/input/byron/votes/vote-yes similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/byron/votes/vote-yes rename to cardano-cli/test/cardano-cli-golden/files/input/byron/votes/vote-yes diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/conway/cold1-cc.skey b/cardano-cli/test/cardano-cli-golden/files/input/conway/cold1-cc.skey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/conway/cold1-cc.skey rename to cardano-cli/test/cardano-cli-golden/files/input/conway/cold1-cc.skey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/conway/genesis.conway.spec.json b/cardano-cli/test/cardano-cli-golden/files/input/conway/genesis.conway.spec.json similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/conway/genesis.conway.spec.json rename to cardano-cli/test/cardano-cli-golden/files/input/conway/genesis.conway.spec.json diff --git a/cardano-cli/test/cardano-cli-golden/files/input/drep.skey b/cardano-cli/test/cardano-cli-golden/files/input/drep.skey deleted file mode 100644 index 2bffd0436e..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/input/drep.skey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "DRepSigningKey_ed25519", - "description": "Delegate Representative Signing Key", - "cborHex": "58201872d334e12a3a062dbdc4f2a22dc77f6e88ba8ecb39d0a2e385375f15ba0005" -} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/key/non-extended-keys/shelley.000.vkey b/cardano-cli/test/cardano-cli-golden/files/input/key/non-extended-keys/shelley.000.vkey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/key/non-extended-keys/shelley.000.vkey rename to cardano-cli/test/cardano-cli-golden/files/input/key/non-extended-keys/shelley.000.vkey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/key/non-extended-keys/stake.000.vkey b/cardano-cli/test/cardano-cli-golden/files/input/key/non-extended-keys/stake.000.vkey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/key/non-extended-keys/stake.000.vkey rename to cardano-cli/test/cardano-cli-golden/files/input/key/non-extended-keys/stake.000.vkey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/mary/scripts/mint.all b/cardano-cli/test/cardano-cli-golden/files/input/mary/scripts/mint.all similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/mary/scripts/mint.all rename to cardano-cli/test/cardano-cli-golden/files/input/mary/scripts/mint.all diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/mary/scripts/mint.sig b/cardano-cli/test/cardano-cli-golden/files/input/mary/scripts/mint.sig similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/mary/scripts/mint.sig rename to cardano-cli/test/cardano-cli-golden/files/input/mary/scripts/mint.sig diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/addresses/enterprise-address.hex b/cardano-cli/test/cardano-cli-golden/files/input/shelley/addresses/enterprise-address.hex similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/addresses/enterprise-address.hex rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/addresses/enterprise-address.hex diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/addresses/staking-address.hex b/cardano-cli/test/cardano-cli-golden/files/input/shelley/addresses/staking-address.hex similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/addresses/staking-address.hex rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/addresses/staking-address.hex diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/genesis_key_delegation_certificate b/cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/genesis_key_delegation_certificate similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/genesis_key_delegation_certificate rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/genesis_key_delegation_certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/mir_certificate b/cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/mir_certificate similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/mir_certificate rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/mir_certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/operational_certificate b/cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/operational_certificate similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/operational_certificate rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/operational_certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/stake_address_delegation_certificate b/cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/stake_address_delegation_certificate similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/stake_address_delegation_certificate rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/stake_address_delegation_certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/stake_address_deregistration_certificate b/cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/stake_address_deregistration_certificate similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/stake_address_deregistration_certificate rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/stake_address_deregistration_certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/stake_address_registration_certificate b/cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/stake_address_registration_certificate similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/stake_address_registration_certificate rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/stake_address_registration_certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/stake_pool_deregistration_certificate b/cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/stake_pool_deregistration_certificate similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/stake_pool_deregistration_certificate rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/stake_pool_deregistration_certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/stake_pool_registration_certificate b/cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/stake_pool_registration_certificate similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/certificates/stake_pool_registration_certificate rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/certificates/stake_pool_registration_certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/genesis/genesis.spec.json b/cardano-cli/test/cardano-cli-golden/files/input/shelley/genesis/genesis.spec.json similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/genesis/genesis.spec.json rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/genesis/genesis.spec.json diff --git a/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/cold.vk b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/cold.vk new file mode 100644 index 0000000000..a58782c085 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/cold.vk @@ -0,0 +1,5 @@ +{ + "type": "StakePoolVerificationKey_ed25519", + "description": "Stake Pool Operator Verification Key", + "cborHex": "582029ade2115fbcbc17f063eec41ec0d358ccc5b52c2bccb47c0918727695619a68" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/create/basic.json b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/create/basic.json new file mode 100644 index 0000000000..35c4821c3e --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/create/basic.json @@ -0,0 +1,41 @@ +{ + "94": { + "map": [ + { + "k": { + "int": 0 + }, + "v": { + "list": [ + { + "string": "Pineapples on pizza?" + } + ] + } + }, + { + "k": { + "int": 1 + }, + "v": { + "list": [ + { + "list": [ + { + "string": "yes" + } + ] + }, + { + "list": [ + { + "string": "no" + } + ] + } + ] + } + } + ] + } +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/create/long-text.json b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/create/long-text.json new file mode 100644 index 0000000000..4adc595572 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/create/long-text.json @@ -0,0 +1,47 @@ +{ + "94": { + "map": [ + { + "k": { + "int": 0 + }, + "v": { + "list": [ + { + "string": "What is the most adequate topping to put on a pizza (please cons" + }, + { + "string": "ider all possibilities and take time to answer)?" + } + ] + } + }, + { + "k": { + "int": 1 + }, + "v": { + "list": [ + { + "list": [ + { + "string": "pineapples" + } + ] + }, + { + "list": [ + { + "string": "only traditional topics should go on a pizza, this isn't room fo" + }, + { + "string": "r jokes" + } + ] + } + ] + } + } + ] + } +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/polls/basic.answer.0.json b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/polls/basic.answer.0.json new file mode 100644 index 0000000000..d327ecda03 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/polls/basic.answer.0.json @@ -0,0 +1,22 @@ +{ + "94": { + "map": [ + { + "k": { + "int": 2 + }, + "v": { + "bytes": "29093fd43fc30ba31e306af06ce8537390e1668ae7496fe53d53684683c3762c" + } + }, + { + "k": { + "int": 3 + }, + "v": { + "int": 0 + } + } + ] + } +} \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/polls/basic.answer.1.json b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/polls/basic.answer.1.json new file mode 100644 index 0000000000..d5e0b3312b --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/polls/basic.answer.1.json @@ -0,0 +1,22 @@ +{ + "94": { + "map": [ + { + "k": { + "int": 2 + }, + "v": { + "bytes": "29093fd43fc30ba31e306af06ce8537390e1668ae7496fe53d53684683c3762c" + } + }, + { + "k": { + "int": 3 + }, + "v": { + "int": 1 + } + } + ] + } +} \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/polls/basic.json b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/polls/basic.json new file mode 100644 index 0000000000..8bca376771 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/polls/basic.json @@ -0,0 +1,5 @@ +{ + "type": "GovernancePoll", + "description": "An on-chain poll for SPOs: Pineapples on pizza?", + "cborHex": "a1185ea200817450696e656170706c6573206f6e2070697a7a613f0182816379657381626e6f" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/verify/valid b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/verify/valid new file mode 100644 index 0000000000..7406268cbd --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/shelley/governance/verify/valid @@ -0,0 +1,5 @@ +{ + "type": "Witnessed Tx BabbageEra", + "description": "Ledger Cddl Format", + "cborHex": "84a50081825820000000000000000000000000000000000000000000000000000000000000000000018002000e81581cf8db28823f8ebd01a2d9e24efb2f0d18e387665770274513e370b5d50758201ea2695790e7d9d0404cee31558ac032e4dd80f1fe971f96d496c73d41ad9d38a1008182582029ade2115fbcbc17f063eec41ec0d358ccc5b52c2bccb47c0918727695619a68584015c6bf278505e6a47f8221737ef475da4b1cd11779eac98edc72824a8c1746525e73a6def3fa1a725e57f90674c9494ee99bd42544fccc3ea06a594a21a65d0ef5d90103a100a1185ea202582029093fd43fc30ba31e306af06ce8537390e1668ae7496fe53d53684683c3762c0301" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/extended_payment_keys/signing_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/extended_payment_keys/signing_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/extended_payment_keys/signing_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/extended_payment_keys/signing_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/extended_payment_keys/verification_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/extended_payment_keys/verification_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/extended_payment_keys/verification_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/extended_payment_keys/verification_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/operational_certificate_counter b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/operational_certificate_counter similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/operational_certificate_counter rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/operational_certificate_counter diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/signing_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/signing_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/signing_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/signing_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/verification_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/verification_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_delegate_keys/verification_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_delegate_keys/verification_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/signing_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/signing_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/signing_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/signing_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/verification_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/verification_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/verification_key.key-hash b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key.key-hash similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_keys/verification_key.key-hash rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key.key-hash diff --git a/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_utxo_hashes/utxo_hash b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_utxo_hashes/utxo_hash new file mode 100644 index 0000000000..67701828dc --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_utxo_hashes/utxo_hash @@ -0,0 +1 @@ +a8905555bf684e27ffbe192c412bf979d120d4788e6e5ccbe8c19cb03906342b#0 diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_utxo_keys/signing_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_utxo_keys/signing_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_utxo_keys/signing_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_utxo_keys/signing_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_utxo_keys/verification_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_utxo_keys/verification_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_utxo_keys/verification_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_utxo_keys/verification_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_verification_keys/genesis-utxo.vkey b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_verification_keys/genesis-utxo.vkey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/genesis_verification_keys/genesis-utxo.vkey rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/genesis_verification_keys/genesis-utxo.vkey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/kes_keys/signing_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/kes_keys/signing_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/kes_keys/signing_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/kes_keys/signing_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/kes_keys/verification_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/kes_keys/verification_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/kes_keys/verification_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/kes_keys/verification_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/signing_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/payment_keys/signing_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/signing_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/payment_keys/signing_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/verification_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/payment_keys/verification_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/payment_keys/verification_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/payment_keys/verification_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/reward_address b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/stake_keys/reward_address similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/reward_address rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/stake_keys/reward_address diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/signing_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/stake_keys/signing_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/signing_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/stake_keys/signing_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/verification_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/stake_keys/verification_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/stake_keys/verification_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/stake_keys/verification_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/vrf_keys/signing_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/vrf_keys/signing_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/vrf_keys/signing_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/vrf_keys/signing_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/vrf_keys/verification_key b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/vrf_keys/verification_key similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/keys/vrf_keys/verification_key rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/vrf_keys/verification_key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/metadata/stake_pool_metadata_hash b/cardano-cli/test/cardano-cli-golden/files/input/shelley/metadata/stake_pool_metadata_hash similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/metadata/stake_pool_metadata_hash rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/metadata/stake_pool_metadata_hash diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/multisig/addresses/all b/cardano-cli/test/cardano-cli-golden/files/input/shelley/multisig/addresses/all similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/multisig/addresses/all rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/multisig/addresses/all diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/multisig/addresses/any b/cardano-cli/test/cardano-cli-golden/files/input/shelley/multisig/addresses/any similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/multisig/addresses/any rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/multisig/addresses/any diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/multisig/scripts/all b/cardano-cli/test/cardano-cli-golden/files/input/shelley/multisig/scripts/all similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/multisig/scripts/all rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/multisig/scripts/all diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/multisig/scripts/any b/cardano-cli/test/cardano-cli-golden/files/input/shelley/multisig/scripts/any similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/multisig/scripts/any rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/multisig/scripts/any diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/multisig/scripts/atleast b/cardano-cli/test/cardano-cli-golden/files/input/shelley/multisig/scripts/atleast similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/multisig/scripts/atleast rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/multisig/scripts/atleast diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/node-pool/operator.vkey b/cardano-cli/test/cardano-cli-golden/files/input/shelley/node-pool/operator.vkey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/node-pool/operator.vkey rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/node-pool/operator.vkey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/node-pool/owner.vkey b/cardano-cli/test/cardano-cli-golden/files/input/shelley/node-pool/owner.vkey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/node-pool/owner.vkey rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/node-pool/owner.vkey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/node-pool/vrf.vkey b/cardano-cli/test/cardano-cli-golden/files/input/shelley/node-pool/vrf.vkey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/node-pool/vrf.vkey rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/node-pool/vrf.vkey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-calculate-min-fee/protocol-params.json b/cardano-cli/test/cardano-cli-golden/files/input/shelley/transaction-calculate-min-fee/protocol-params.json similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-calculate-min-fee/protocol-params.json rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/transaction-calculate-min-fee/protocol-params.json diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-sign/node-cold.skey b/cardano-cli/test/cardano-cli-golden/files/input/shelley/transaction-sign/node-cold.skey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-sign/node-cold.skey rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/transaction-sign/node-cold.skey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-sign/stake.skey b/cardano-cli/test/cardano-cli-golden/files/input/shelley/transaction-sign/stake.skey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-sign/stake.skey rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/transaction-sign/stake.skey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-sign/utxo.skey b/cardano-cli/test/cardano-cli-golden/files/input/shelley/transaction-sign/utxo.skey similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-sign/utxo.skey rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/transaction-sign/utxo.skey diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/tx/txbody b/cardano-cli/test/cardano-cli-golden/files/input/shelley/tx/txbody similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/tx/txbody rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/tx/txbody diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/tx/unsigned.tx b/cardano-cli/test/cardano-cli-golden/files/input/shelley/tx/unsigned.tx similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/tx/unsigned.tx rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/tx/unsigned.tx diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/witnesses/singleSigningKeyWitness b/cardano-cli/test/cardano-cli-golden/files/input/shelley/witnesses/singleSigningKeyWitness similarity index 100% rename from cardano-cli/test/cardano-cli-golden/files/golden/shelley/witnesses/singleSigningKeyWitness rename to cardano-cli/test/cardano-cli-golden/files/input/shelley/witnesses/singleSigningKeyWitness diff --git a/cardano-cli/test/cardano-cli-test-lib/Test/Cardano/CLI/Util.hs b/cardano-cli/test/cardano-cli-test-lib/Test/Cardano/CLI/Util.hs index a231278625..f3331e534f 100644 --- a/cardano-cli/test/cardano-cli-test-lib/Test/Cardano/CLI/Util.hs +++ b/cardano-cli/test/cardano-cli-test-lib/Test/Cardano/CLI/Util.hs @@ -32,7 +32,11 @@ import Data.Monoid (Last (..)) import Data.Text (Text) import GHC.Stack (CallStack, HasCallStack) import qualified GHC.Stack as GHC +import qualified System.Directory as IO +import qualified System.Environment as IO import qualified System.Exit as IO +import System.FilePath (takeDirectory) +import qualified System.IO.Unsafe as IO import qualified System.Process as IO import System.Process (CreateProcess) @@ -148,12 +152,35 @@ checkTxCddlFormat -> FilePath -- ^ Newly created file -> m () checkTxCddlFormat referencePath createdPath = do - reference <- H.evalIO $ fileOrPipe referencePath - created <- H.evalIO $ fileOrPipe createdPath - r <- H.evalIO $ readCddlTx reference - c <- H.evalIO $ readCddlTx created - r H.=== c + fileExists <- liftIO $ IO.doesFileExist referencePath + + if fileExists + then do + reference <- H.evalIO $ fileOrPipe referencePath + created <- H.evalIO $ fileOrPipe createdPath + r <- H.evalIO $ readCddlTx reference + c <- H.evalIO $ readCddlTx created + r H.=== c + else if createFiles + then do + -- CREATE_GOLDEN_FILES is set, so we create any golden files that don't + -- already exist. + H.note_ $ "Creating golden file " <> referencePath + H.createDirectoryIfMissing_ (takeDirectory referencePath) + H.readFile createdPath >>= H.writeFile referencePath + else do + H.note_ $ mconcat + [ "Golden file " <> referencePath + , " does not exist. To create, run with CREATE_GOLDEN_FILES=1" + ] + H.failure + +-- | Whether the test should create the golden files if the file does ont exist. +createFiles :: Bool +createFiles = IO.unsafePerformIO $ do + value <- IO.lookupEnv "CREATE_GOLDEN_FILES" + return $ value == Just "1" -------------------------------------------------------------------------------- -- Helpers, Error rendering & Clean up