From 5b2bbdf50bdd1dc8af79a9776ac1f1c13046079b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Mon, 13 Nov 2023 10:42:58 +0100 Subject: [PATCH 1/2] Shelley/Node: harden an existing test --- .../Test/Golden/Shelley/Node/KeyGenKes.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyGenKes.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyGenKes.hs index 53935a33d3..cbe2a6a333 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyGenKes.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyGenKes.hs @@ -4,6 +4,7 @@ module Test.Golden.Shelley.Node.KeyGenKes where import Control.Monad (void) +import Test.Cardano.CLI.Aeson import Test.Cardano.CLI.Util import Hedgehog (Property) @@ -23,8 +24,8 @@ hprop_golden_shelleyNodeKeyGenKes = propertyOnce . H.moduleWorkspace "tmp" $ \te , "--signing-key-file", signingKey ] - H.assertFileOccurences 1 "KesVerificationKey_ed25519_kes_2^6" verificationKey - H.assertFileOccurences 1 "KesSigningKey_ed25519_kes_2^6" signingKey + assertHasMappings [("type", "KesVerificationKey_ed25519_kes_2^6"), ("description", "KES Verification Key")] verificationKey + assertHasMappings [("type", "KesSigningKey_ed25519_kes_2^6"), ("description", "KES Signing Key")] signingKey H.assertEndsWithSingleNewline verificationKey H.assertEndsWithSingleNewline signingKey @@ -41,8 +42,8 @@ hprop_golden_shelleyNodeKeyGenKes_te = propertyOnce . H.moduleWorkspace "tmp" $ , "--signing-key-file", signingKey ] - H.assertFileOccurences 1 "KesVerificationKey_ed25519_kes_2^6" verificationKey - H.assertFileOccurences 1 "KesSigningKey_ed25519_kes_2^6" signingKey + assertHasMappings [("type", "KesVerificationKey_ed25519_kes_2^6"), ("description", "KES Verification Key")] verificationKey + assertHasMappings [("type", "KesSigningKey_ed25519_kes_2^6"), ("description", "KES Signing Key")] signingKey H.assertEndsWithSingleNewline verificationKey H.assertEndsWithSingleNewline signingKey From 76893fc6d32308976b2c702acb23e5a439b95c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Mon, 13 Nov 2023 11:00:21 +0100 Subject: [PATCH 2/2] Shelley/Node: harden an existing test --- .../Test/Golden/Shelley/Node/KeyGen.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyGen.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyGen.hs index b88b5220b1..693f18a868 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyGen.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyGen.hs @@ -5,6 +5,7 @@ module Test.Golden.Shelley.Node.KeyGen import Control.Monad (void) +import Test.Cardano.CLI.Aeson import Test.Cardano.CLI.Util import Hedgehog (Property) @@ -26,9 +27,9 @@ hprop_golden_shelleyNodeKeyGen = propertyOnce . H.moduleWorkspace "tmp" $ \tempD , "--operational-certificate-issue-counter", opCertCounterFile ] - H.assertFileOccurences 1 "StakePoolVerificationKey_ed25519" verificationKeyFile - H.assertFileOccurences 1 "StakePoolSigningKey_ed25519" signingKeyFile - H.assertFileOccurences 1 "NodeOperationalCertificateIssueCounter" opCertCounterFile + assertHasMappings [("type", "StakePoolVerificationKey_ed25519"), ("description", "Stake Pool Operator Verification Key")] verificationKeyFile + assertHasMappings [("type", "StakePoolSigningKey_ed25519"), ("description", "Stake Pool Operator Signing Key")] signingKeyFile + assertHasMappings [("type", "NodeOperationalCertificateIssueCounter"), ("description", "Next certificate issue number: 0")] opCertCounterFile H.assertEndsWithSingleNewline verificationKeyFile H.assertEndsWithSingleNewline signingKeyFile @@ -47,9 +48,9 @@ hprop_golden_shelleyNodeKeyGen_te = propertyOnce . H.moduleWorkspace "tmp" $ \te , "--operational-certificate-issue-counter", opCertCounterFile ] - H.assertFileOccurences 1 "StakePoolVerificationKey_ed25519" verificationKeyFile - H.assertFileOccurences 1 "StakePoolSigningKey_ed25519" signingKeyFile - H.assertFileOccurences 1 "NodeOperationalCertificateIssueCounter" opCertCounterFile + assertHasMappings [("type", "StakePoolVerificationKey_ed25519"), ("description", "Stake Pool Operator Verification Key")] verificationKeyFile + assertHasMappings [("type", "StakePoolSigningKey_ed25519"), ("description", "Stake Pool Operator Signing Key")] signingKeyFile + assertHasMappings [("type", "NodeOperationalCertificateIssueCounter"), ("description", "Next certificate issue number: 0")] opCertCounterFile H.assertEndsWithSingleNewline verificationKeyFile H.assertEndsWithSingleNewline signingKeyFile @@ -71,6 +72,6 @@ hprop_golden_shelleyNodeKeyGen_bech32 = propertyOnce . H.moduleWorkspace "tmp" $ H.assertFileOccurences 1 "pool_vk" verificationKeyFile H.assertFileOccurences 1 "pool_sk" signingKeyFile - H.assertFileOccurences 1 "NodeOperationalCertificateIssueCounter" opCertCounterFile + assertHasMappings [("type", "NodeOperationalCertificateIssueCounter"), ("description", "Next certificate issue number: 0")] opCertCounterFile H.assertEndsWithSingleNewline opCertCounterFile