Skip to content
Open
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
9 changes: 9 additions & 0 deletions cardano-testnet/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
For information on how to use this package, see [Launching a Testnet](https://developers.cardano.org/docs/get-started/cardano-testnet)

## Supported versions

cardano-testnet is designed to run the cardano-cli and cardano-node that ship
in the same release. Mixing binaries across releases is unsupported; use cli
and node from the same release tarball as this cardano-testnet.

The cardano-api and cardano-cli versions this build was compiled against are
printed by `cardano-testnet version`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Added

- Added "Supported versions" section to README declaring the single-release policy for cli/node compatibility.
- `cardano-testnet version` now reports the cardano-api and cardano-cli versions it was built against.

3 changes: 3 additions & 0 deletions cardano-testnet/src/Parsers/Version.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskell #-}

module Parsers.Version
Expand Down Expand Up @@ -33,6 +34,8 @@ runVersionOptions VersionOptions = do
, " - ", os, "-", arch
, " - ", compilerName, "-", showVersion compilerVersion
, "\ngit rev ", T.unpack $(gitRev)
, "\nbuilt against cardano-api ", VERSION_cardano_api
, "\nbuilt against cardano-cli ", VERSION_cardano_cli
]

cmdVersion :: Mod CommandFields VersionOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
module Cardano.Testnet.Test.Golden.Help
( golden_HelpAll
, golden_HelpCmds
, golden_VersionCmd
) where

import Cardano.Testnet.Test.Golden.Util
Expand Down Expand Up @@ -102,3 +103,24 @@ golden_HelpCmds =
cmdHelp <- filterAnsi . second <$> execDetailCardanoTestnet (fmap Text.unpack usage <> ["--help"])

H.diffVsGoldenFile cmdHelp expectedCmdHelpFp

-- | Filter out volatile lines from 'cardano-testnet version' output.
-- Removes the first two lines: The first one contains package version,
-- OS, arch, compiler and the second one is the git rev line.
filterVersionOutput :: String -> String
filterVersionOutput =
unlines . drop 2 . map Text.unpack . Text.lines . Text.pack

-- | Execute me with:
-- @DISABLE_RETRIES=1 cabal test cardano-testnet-golden --test-options '-p "/golden_VersionCmd/"'@
golden_VersionCmd :: Property
golden_VersionCmd =
H.propertyOnce . H.moduleWorkspace "version-cmd" $ \_ -> do
unless isWin32 $ do
versionFp <- H.note "test/cardano-testnet-golden/files/golden/version_cmd.cli"

versionOutput <- filterVersionOutput . filterAnsi <$> execCardanoTestnet
[ "version"
]

H.diffVsGoldenFile versionOutput versionFp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ tests = pure $ T.testGroup "Golden tests"
[ H.testPropertyNamed "golden_DefaultConfig" (fromString "golden_DefaultConfig") Cardano.Testnet.Test.Golden.Config.goldenDefaultConfigYaml
, H.testPropertyNamed "golden_HelpAll" (fromString "golden_HelpAll") Cardano.Testnet.Test.Golden.Help.golden_HelpAll
, H.testPropertyNamed "golden_HelpCmds" (fromString "golden_HelpCmds") Cardano.Testnet.Test.Golden.Help.golden_HelpCmds
, H.testPropertyNamed "golden_VersionCmd" (fromString "golden_VersionCmd") Cardano.Testnet.Test.Golden.Help.golden_VersionCmd
]

ingredients :: [T.Ingredient]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
built against cardano-api 10.26.0.0
built against cardano-cli 10.16.0.0
Loading