From 907ea04f7f1b16b0ba5dba2433de6d539234acde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Wed, 8 Nov 2023 15:33:03 +0100 Subject: [PATCH] Shelley/Genesis: harden an existing test --- .../Golden/Shelley/Genesis/KeyGenDelegate.hs | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/KeyGenDelegate.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/KeyGenDelegate.hs index 1f5dc8e42a..e0b6f8d386 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/KeyGenDelegate.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Genesis/KeyGenDelegate.hs @@ -4,6 +4,7 @@ module Test.Golden.Shelley.Genesis.KeyGenDelegate where import Control.Monad (void) +import Test.Cardano.CLI.Aeson import Test.Cardano.CLI.Util import Hedgehog (Property) @@ -12,8 +13,8 @@ import qualified Hedgehog.Extras.Test.File as H {- HLINT ignore "Use camelCase" -} -hprop_golden_shelleyGenesisKeyGenDelegate :: Property -hprop_golden_shelleyGenesisKeyGenDelegate = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do +hprop_golden_shelley_genesis_key_gen_delegate :: Property +hprop_golden_shelley_genesis_key_gen_delegate = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do verificationKeyFile <- noteTempFile tempDir "key-gen.vkey" signingKeyFile <- noteTempFile tempDir "key-gen.skey" operationalCertificateIssueCounterFile <- noteTempFile tempDir "op-cert.counter" @@ -25,13 +26,20 @@ hprop_golden_shelleyGenesisKeyGenDelegate = propertyOnce . H.moduleWorkspace "tm , "--operational-certificate-issue-counter", operationalCertificateIssueCounterFile ] - H.assertFileOccurences 1 "GenesisDelegateVerificationKey_ed25519" verificationKeyFile - H.assertFileOccurences 1 "GenesisDelegateSigningKey_ed25519" signingKeyFile - H.assertFileOccurences 1 "NodeOperationalCertificateIssueCounter" operationalCertificateIssueCounterFile - - H.assertFileOccurences 1 "Genesis delegate operator key" verificationKeyFile - H.assertFileOccurences 1 "Genesis delegate operator key" signingKeyFile - + assertHasMappings [("type", "GenesisDelegateVerificationKey_ed25519"), + ("description", "Genesis delegate operator key")] + verificationKeyFile + assertHasKeys ["cborHex"] verificationKeyFile H.assertEndsWithSingleNewline verificationKeyFile + + assertHasMappings [("type", "GenesisDelegateSigningKey_ed25519"), + ("description", "Genesis delegate operator key")] + signingKeyFile + assertHasKeys ["cborHex"] signingKeyFile H.assertEndsWithSingleNewline signingKeyFile + + assertHasMappings [("type", "NodeOperationalCertificateIssueCounter"), + ("description", "Next certificate issue number: 0")] + operationalCertificateIssueCounterFile + assertHasKeys ["cborHex"] operationalCertificateIssueCounterFile H.assertEndsWithSingleNewline operationalCertificateIssueCounterFile