diff --git a/cardano-testnet/README.md b/cardano-testnet/README.md index 01ab79ecec9..1f25ab385a2 100644 --- a/cardano-testnet/README.md +++ b/cardano-testnet/README.md @@ -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`. diff --git a/cardano-testnet/changelog.d/20260424_015940_palas_tag_testnet_compatibility.md b/cardano-testnet/changelog.d/20260424_015940_palas_tag_testnet_compatibility.md new file mode 100644 index 00000000000..ae2a0c6dee4 --- /dev/null +++ b/cardano-testnet/changelog.d/20260424_015940_palas_tag_testnet_compatibility.md @@ -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. + diff --git a/cardano-testnet/src/Parsers/Version.hs b/cardano-testnet/src/Parsers/Version.hs index 001be130a84..2b5bb465220 100644 --- a/cardano-testnet/src/Parsers/Version.hs +++ b/cardano-testnet/src/Parsers/Version.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} module Parsers.Version @@ -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 diff --git a/cardano-testnet/test/cardano-testnet-golden/Cardano/Testnet/Test/Golden/Help.hs b/cardano-testnet/test/cardano-testnet-golden/Cardano/Testnet/Test/Golden/Help.hs index 698c4af014b..e800c948b54 100644 --- a/cardano-testnet/test/cardano-testnet-golden/Cardano/Testnet/Test/Golden/Help.hs +++ b/cardano-testnet/test/cardano-testnet-golden/Cardano/Testnet/Test/Golden/Help.hs @@ -5,6 +5,7 @@ module Cardano.Testnet.Test.Golden.Help ( golden_HelpAll , golden_HelpCmds + , golden_VersionCmd ) where import Cardano.Testnet.Test.Golden.Util @@ -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 diff --git a/cardano-testnet/test/cardano-testnet-golden/cardano-testnet-golden.hs b/cardano-testnet/test/cardano-testnet-golden/cardano-testnet-golden.hs index 9fd801a2d22..4bcfd8f4c7d 100644 --- a/cardano-testnet/test/cardano-testnet-golden/cardano-testnet-golden.hs +++ b/cardano-testnet/test/cardano-testnet-golden/cardano-testnet-golden.hs @@ -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] diff --git a/cardano-testnet/test/cardano-testnet-golden/files/golden/version_cmd.cli b/cardano-testnet/test/cardano-testnet-golden/files/golden/version_cmd.cli new file mode 100644 index 00000000000..73d5ccf14d6 --- /dev/null +++ b/cardano-testnet/test/cardano-testnet-golden/files/golden/version_cmd.cli @@ -0,0 +1,2 @@ +built against cardano-api 10.26.0.0 +built against cardano-cli 10.16.0.0