From f531f8d0b44e3dd0f5d68d5bffb9f701ca4b5679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Wed, 24 Jan 2024 14:42:40 +0100 Subject: [PATCH] create-testnet-data: test minimal example --- cardano-cli/cardano-cli.cabal | 1 + .../Test/Cli/CreateTestnetData.hs | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 cardano-cli/test/cardano-cli-test/Test/Cli/CreateTestnetData.hs diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 962f7a88ff..f3bdaca467 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -307,6 +307,7 @@ test-suite cardano-cli-test other-modules: Test.Cli.AddCostModels Test.Cli.CliIntermediateFormat + Test.Cli.CreateTestnetData Test.Cli.FilePermissions Test.Cli.Governance.Hash Test.Cli.ITN diff --git a/cardano-cli/test/cardano-cli-test/Test/Cli/CreateTestnetData.hs b/cardano-cli/test/cardano-cli-test/Test/Cli/CreateTestnetData.hs new file mode 100644 index 0000000000..0259d043ec --- /dev/null +++ b/cardano-cli/test/cardano-cli-test/Test/Cli/CreateTestnetData.hs @@ -0,0 +1,29 @@ +module Test.Cli.CreateTestnetData where + + + +import System.FilePath + +import Test.Cardano.CLI.Util (execCardanoCLI) + +import Hedgehog (Property) +import Hedgehog.Extras (moduleWorkspace, propertyOnce) +import qualified Hedgehog.Extras as H + +-- | Test case for https://github.com/IntersectMBO/cardano-cli/issues/587 +-- Execute this test with: +-- @cabal test cardano-cli-test --test-options '-p "/create testnet data minimal/"'@ +hprop_create_testnet_data_minimal :: Property +hprop_create_testnet_data_minimal = + propertyOnce $ moduleWorkspace "tmp" $ \tempDir -> do + + let outputDir = tempDir "out" + + H.noteM_ $ execCardanoCLI + ["conway", "genesis", "create-testnet-data" + , "--testnet-magic", "42" + , "--out-dir", outputDir + ] + + -- We test that the command doesn't crash, because otherwise + -- execCardanoCLI would fail. \ No newline at end of file