Skip to content

Commit

Permalink
Move files that are not golden files into input directory
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Oct 3, 2023
1 parent 1a140f5 commit 187688f
Show file tree
Hide file tree
Showing 115 changed files with 201 additions and 189 deletions.
3 changes: 3 additions & 0 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ library cardano-cli-test-lib
, bytestring
, cardano-api
, cardano-cli
, directory
, exceptions
, filepath
, hedgehog
, hedgehog-extras ^>= 0.4.7.0
, process
Expand All @@ -295,6 +297,7 @@ test-suite cardano-cli-test
, cardano-cli:cardano-cli-test-lib
, cardano-slotting
, containers
, directory
, filepath
, hedgehog
, hedgehog-extras ^>= 0.4.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
8 changes: 4 additions & 4 deletions cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import Hedgehog.Internal.Property (failWith)

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"
signingKey <- noteInputFile "test/cardano-cli-golden/files/input/byron/keys/legacy.skey"
goldenTx <- noteInputFile "test/cardano-cli-golden/files/input/byron/tx/legacy.tx"
createdTx <- noteTempFile tempDir "tx"
void $ execCardanoCLI
[ "byron", "transaction", "issue-utxo-expenditure"
Expand All @@ -41,8 +41,8 @@ hprop_golden_byronTx_legacy = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir

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"
signingKey <- noteInputFile "test/cardano-cli-golden/files/input/byron/keys/byron.skey"
goldenTx <- noteInputFile "test/cardano-cli-golden/files/input/byron/tx/normal.tx"
createdTx <- noteTempFile tempDir "tx"
void $ execCardanoCLI
[ "byron", "transaction", "issue-utxo-expenditure"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import Hedgehog.Internal.Property (failWith)

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"
goldenUpdateProposal <- 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"
Expand Down
12 changes: 6 additions & 6 deletions cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import Hedgehog.Internal.Property (failWith)

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"
goldenYesVote <- 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"
Expand All @@ -46,9 +46,9 @@ hprop_golden_byron_yes_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir

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

Expand All @@ -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"

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import qualified Hedgehog.Extras.Test.File as H

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"
goldenUtxoHashFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/keys/genesis_utxo_hashes/utxo_hash"
verificationKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_verification_keys/genesis-utxo.vkey"
goldenUtxoHashFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/genesis_utxo_hashes/utxo_hash"
utxoHashFile <- noteTempFile tempDir "utxo_hash"

utxoHash <- execCardanoCLI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import qualified Hedgehog.Extras.Test.Golden as H

hprop_golden_shelleyGovernanceAnswerPollNeg1Invalid :: Property
hprop_golden_shelleyGovernanceAnswerPollNeg1Invalid = propertyOnce . H.moduleWorkspace "governance-answer-poll" $ \tempDir -> do
pollFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/governance/polls/basic.json"
pollFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/governance/polls/basic.json"
outFile <- H.noteTempFile tempDir "answer-file.json"

result <- tryExecCardanoCLI
Expand All @@ -32,8 +32,8 @@ hprop_golden_shelleyGovernanceAnswerPollNeg1Invalid = propertyOnce . H.moduleWor

hprop_golden_shelleyGovernanceAnswerPoll0 :: Property
hprop_golden_shelleyGovernanceAnswerPoll0 = propertyOnce . H.moduleWorkspace "governance-answer-poll" $ \tempDir -> do
pollFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/governance/polls/basic.json"
expectedAnswerFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/governance/polls/basic.answer.0.json"
pollFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/governance/polls/basic.json"
expectedAnswerFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/governance/polls/basic.answer.0.json"
outFile <- H.noteTempFile tempDir "answer-file.json"

void $ execCardanoCLI
Expand All @@ -47,8 +47,8 @@ hprop_golden_shelleyGovernanceAnswerPoll0 = propertyOnce . H.moduleWorkspace "go

hprop_golden_shelleyGovernanceAnswerPollPos1 :: Property
hprop_golden_shelleyGovernanceAnswerPollPos1 = propertyOnce . H.moduleWorkspace "governance-answer-poll" $ \tempDir -> do
pollFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/governance/polls/basic.json"
expectedAnswerFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/governance/polls/basic.answer.1.json"
pollFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/governance/polls/basic.json"
expectedAnswerFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/governance/polls/basic.answer.1.json"
outFile <- H.noteTempFile tempDir "answer-file.json"

void $ execCardanoCLI
Expand All @@ -62,7 +62,7 @@ hprop_golden_shelleyGovernanceAnswerPollPos1 = propertyOnce . H.moduleWorkspace

hprop_golden_shelleyGovernanceAnswerPollPos2Invalid :: Property
hprop_golden_shelleyGovernanceAnswerPollPos2Invalid = propertyOnce . H.moduleWorkspace "governance-answer-poll" $ \tempDir -> do
pollFile <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/governance/polls/basic.json"
pollFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/governance/polls/basic.json"
outFile <- H.noteTempFile tempDir "answer-file.json"

result <- tryExecCardanoCLI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ hprop_golden_shelleyGovernanceCreatePoll =
]

void $ H.readFile pollFile
noteInputFile "test/cardano-cli-golden/files/golden/shelley/governance/create/basic.json"
noteInputFile "test/cardano-cli-golden/files/input/shelley/governance/create/basic.json"
>>= H.readFile
>>= (H.===) stdout
H.assertFileOccurences 1 "GovernancePoll" pollFile
Expand All @@ -47,7 +47,7 @@ hprop_golden_shelleyGovernanceCreateLongPoll =
]

void $ H.readFile pollFile
noteInputFile "test/cardano-cli-golden/files/golden/shelley/governance/create/long-text.json"
noteInputFile "test/cardano-cli-golden/files/input/shelley/governance/create/long-text.json"
>>= H.readFile
>>= (H.===) stdout
H.assertFileOccurences 1 "GovernancePoll" pollFile
Expand Down
Loading

0 comments on commit 187688f

Please sign in to comment.