Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace usages of assertFileOccurences (5/6) #448

Merged
merged 5 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import qualified Data.HashMap.Lazy as HM
import qualified Data.Set as S
import qualified Data.Time.Clock as DT

import Test.Cardano.CLI.Aeson (assertHasMappings)
import Test.Cardano.CLI.Util as OP

import Hedgehog (Property, forAll, (===))
Expand Down Expand Up @@ -129,24 +130,24 @@ hprop_golden_shelleyGenesisCreate = propertyOnce $ do

for_ [1 .. delegateCount] $ \i -> do
-- Check Genesis keys
H.assertFileOccurences 1 "GenesisSigningKey_ed25519" $ tempDir <> "/genesis-keys/genesis" <> show i <> ".skey"
H.assertFileOccurences 1 "GenesisVerificationKey_ed25519" $ tempDir <> "/genesis-keys/genesis" <> show i <> ".vkey"
assertHasMappings [("type", "GenesisVerificationKey_ed25519")] $ tempDir <> "/genesis-keys/genesis" <> show i <> ".vkey"
assertHasMappings [("type", "GenesisSigningKey_ed25519")] $ tempDir <> "/genesis-keys/genesis" <> show i <> ".skey"

H.assertEndsWithSingleNewline $ tempDir <> "/genesis-keys/genesis" <> show i <> ".skey"
H.assertEndsWithSingleNewline $ tempDir <> "/genesis-keys/genesis" <> show i <> ".vkey"

-- Check delegate keys
H.assertFileOccurences 1 "GenesisDelegateSigningKey_ed25519" $ tempDir <> "/delegate-keys/delegate" <> show i <> ".skey"
H.assertFileOccurences 1 "GenesisDelegateVerificationKey_ed25519" $ tempDir <> "/delegate-keys/delegate" <> show i <> ".vkey"
H.assertFileOccurences 1 "NodeOperationalCertificateIssueCounter" $ tempDir <> "/delegate-keys/delegate" <> show i <> ".counter"
assertHasMappings [("type", "GenesisDelegateSigningKey_ed25519")] $ tempDir <> "/delegate-keys/delegate" <> show i <> ".skey"
assertHasMappings [("type", "GenesisDelegateVerificationKey_ed25519")] $ tempDir <> "/delegate-keys/delegate" <> show i <> ".vkey"
assertHasMappings [("type", "NodeOperationalCertificateIssueCounter")] $ tempDir <> "/delegate-keys/delegate" <> show i <> ".counter"

H.assertEndsWithSingleNewline $ tempDir <> "/delegate-keys/delegate" <> show i <> ".skey"
H.assertEndsWithSingleNewline $ tempDir <> "/delegate-keys/delegate" <> show i <> ".vkey"
H.assertEndsWithSingleNewline $ tempDir <> "/delegate-keys/delegate" <> show i <> ".counter"

-- Check utxo keys
H.assertFileOccurences 1 "GenesisUTxOSigningKey_ed25519" $ tempDir <> "/utxo-keys/utxo" <> show i <> ".skey"
H.assertFileOccurences 1 "GenesisUTxOVerificationKey_ed25519" $ tempDir <> "/utxo-keys/utxo" <> show i <> ".vkey"
assertHasMappings [("type", "GenesisUTxOSigningKey_ed25519")] $ tempDir <> "/utxo-keys/utxo" <> show i <> ".skey"
assertHasMappings [("type", "GenesisUTxOVerificationKey_ed25519")] $ tempDir <> "/utxo-keys/utxo" <> show i <> ".vkey"

H.assertEndsWithSingleNewline $ tempDir <> "/utxo-keys/utxo" <> show i <> ".skey"
H.assertEndsWithSingleNewline $ tempDir <> "/utxo-keys/utxo" <> show i <> ".vkey"
Expand Down Expand Up @@ -208,24 +209,24 @@ hprop_golden_shelleyGenesisCreate = propertyOnce $ do

for_ [1 .. delegateCount] $ \i -> do
-- Check Genesis keys
H.assertFileOccurences 1 "GenesisSigningKey_ed25519" $ tempDir <> "/genesis-keys/genesis" <> show i <> ".skey"
H.assertFileOccurences 1 "GenesisVerificationKey_ed25519" $ tempDir <> "/genesis-keys/genesis" <> show i <> ".vkey"
assertHasMappings [("type", "GenesisSigningKey_ed25519")] $ tempDir <> "/genesis-keys/genesis" <> show i <> ".skey"
assertHasMappings [("type", "GenesisVerificationKey_ed25519")] $ tempDir <> "/genesis-keys/genesis" <> show i <> ".vkey"

H.assertEndsWithSingleNewline $ tempDir <> "/genesis-keys/genesis" <> show i <> ".skey"
H.assertEndsWithSingleNewline $ tempDir <> "/genesis-keys/genesis" <> show i <> ".vkey"

-- Check delegate keys
H.assertFileOccurences 1 "GenesisDelegateSigningKey_ed25519" $ tempDir <> "/delegate-keys/delegate" <> show i <> ".skey"
H.assertFileOccurences 1 "GenesisDelegateVerificationKey_ed25519" $ tempDir <> "/delegate-keys/delegate" <> show i <> ".vkey"
H.assertFileOccurences 1 "NodeOperationalCertificateIssueCounter" $ tempDir <> "/delegate-keys/delegate" <> show i <> ".counter"
assertHasMappings [("type", "GenesisDelegateSigningKey_ed25519")] $ tempDir <> "/delegate-keys/delegate" <> show i <> ".skey"
assertHasMappings [("type", "GenesisDelegateVerificationKey_ed25519")] $ tempDir <> "/delegate-keys/delegate" <> show i <> ".vkey"
assertHasMappings [("type", "NodeOperationalCertificateIssueCounter")] $ tempDir <> "/delegate-keys/delegate" <> show i <> ".counter"

H.assertEndsWithSingleNewline $ tempDir <> "/delegate-keys/delegate" <> show i <> ".skey"
H.assertEndsWithSingleNewline $ tempDir <> "/delegate-keys/delegate" <> show i <> ".vkey"
H.assertEndsWithSingleNewline $ tempDir <> "/delegate-keys/delegate" <> show i <> ".counter"

-- Check utxo keys
H.assertFileOccurences 1 "GenesisUTxOSigningKey_ed25519" $ tempDir <> "/utxo-keys/utxo" <> show i <> ".skey"
H.assertFileOccurences 1 "GenesisUTxOVerificationKey_ed25519" $ tempDir <> "/utxo-keys/utxo" <> show i <> ".vkey"
assertHasMappings [("type", "GenesisUTxOSigningKey_ed25519")] $ tempDir <> "/utxo-keys/utxo" <> show i <> ".skey"
assertHasMappings [("type", "GenesisUTxOVerificationKey_ed25519")] $ tempDir <> "/utxo-keys/utxo" <> show i <> ".vkey"

H.assertEndsWithSingleNewline $ tempDir <> "/utxo-keys/utxo" <> show i <> ".skey"
H.assertEndsWithSingleNewline $ tempDir <> "/utxo-keys/utxo" <> show i <> ".vkey"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Test.Golden.Shelley.Genesis.KeyGenGenesis where

import Control.Monad (void)

import Test.Cardano.CLI.Aeson
import Test.Cardano.CLI.Util

import Hedgehog (Property)
Expand All @@ -23,8 +24,8 @@ hprop_golden_shelleyGenesisKeyGenGenesis = propertyOnce . H.moduleWorkspace "tmp
, "--signing-key-file", signingKeyFile
]

H.assertFileOccurences 1 "GenesisVerificationKey_ed25519" verificationKeyFile
H.assertFileOccurences 1 "GenesisSigningKey_ed25519" signingKeyFile
assertHasMappings [("type", "GenesisVerificationKey_ed25519")] verificationKeyFile
assertHasMappings [("type", "GenesisSigningKey_ed25519")] signingKeyFile

H.assertEndsWithSingleNewline verificationKeyFile
H.assertEndsWithSingleNewline signingKeyFile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Test.Golden.Shelley.Genesis.KeyGenUtxo where

import Control.Monad (void)

import Test.Cardano.CLI.Aeson
import Test.Cardano.CLI.Util

import Hedgehog (Property)
Expand All @@ -23,8 +24,8 @@ hprop_golden_shelleyGenesisKeyGenUtxo = propertyOnce . H.moduleWorkspace "tmp" $
, "--signing-key-file", utxoSigningKeyFile
]

H.assertFileOccurences 1 "GenesisUTxOVerificationKey_ed25519" utxoVerificationKeyFile
H.assertFileOccurences 1 "GenesisUTxOSigningKey_ed25519" utxoSigningKeyFile
assertHasMappings [("type", "GenesisUTxOVerificationKey_ed25519")] utxoVerificationKeyFile
assertHasMappings [("type", "GenesisUTxOSigningKey_ed25519")] utxoSigningKeyFile

H.assertEndsWithSingleNewline utxoVerificationKeyFile
H.assertEndsWithSingleNewline utxoSigningKeyFile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Test.Golden.Shelley.Node.IssueOpCert where

import Control.Monad (void)

import Test.Cardano.CLI.Aeson (assertHasMappings)
import Test.Cardano.CLI.Util

import Hedgehog (Property)
Expand Down Expand Up @@ -37,8 +38,8 @@ hprop_golden_shelleyNodeIssueOpCert = propertyOnce . H.moduleWorkspace "tmp" $ \
, "--out-file", operationalCertFile
]

H.assertFileOccurences 1 "NodeOperationalCertificate" operationalCertFile
H.assertFileOccurences 1 "Next certificate issue number: 1" operationalCertificateIssueCounterFile
assertHasMappings [("type", "NodeOperationalCertificate")] operationalCertFile
assertHasMappings [("type", "NodeOperationalCertificateIssueCounter"), ("description", "Next certificate issue number: 1")] operationalCertificateIssueCounterFile

H.assertEndsWithSingleNewline operationalCertFile
H.assertEndsWithSingleNewline operationalCertificateIssueCounterFile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Test.Golden.Shelley.Node.KeyGenVrf where

import Control.Monad (void)

import Test.Cardano.CLI.Aeson
import Test.Cardano.CLI.Util

import Hedgehog (Property)
Expand All @@ -23,8 +24,8 @@ hprop_golden_shelleyNodeKeyGenVrf = propertyOnce . H.moduleWorkspace "tmp" $ \te
, "--signing-key-file", signingKey
]

H.assertFileOccurences 1 "VRF Verification Key" verificationKey
H.assertFileOccurences 1 "VRF Signing Key" signingKey
assertHasMappings [("type", "VrfVerificationKey_PraosVRF"), ("description", "VRF Verification Key")] verificationKey
assertHasMappings [("type", "VrfSigningKey_PraosVRF"), ("description", "VRF Signing Key")] signingKey

H.assertEndsWithSingleNewline verificationKey
H.assertEndsWithSingleNewline signingKey
Expand All @@ -41,8 +42,8 @@ hprop_golden_shelleyNodeKeyGenVrf_te = propertyOnce . H.moduleWorkspace "tmp" $
, "--signing-key-file", signingKey
]

H.assertFileOccurences 1 "VRF Verification Key" verificationKey
H.assertFileOccurences 1 "VRF Signing Key" signingKey
assertHasMappings [("type", "VrfVerificationKey_PraosVRF"), ("description", "VRF Verification Key")] verificationKey
assertHasMappings [("type", "VrfSigningKey_PraosVRF"), ("description", "VRF Signing Key")] signingKey

H.assertEndsWithSingleNewline verificationKey
H.assertEndsWithSingleNewline signingKey
Expand Down