Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/cachix/cachix-ac…
Browse files Browse the repository at this point in the history
…tion-15
  • Loading branch information
v0d1ch committed May 26, 2024
2 parents 521c63f + 799dc0f commit ed3769f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-tutorial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
with open("hydra-cluster/test/Test/CardanoNodeSpec.hs", "r") as cardanoNodeSpecFile:
body = cardanoNodeSpecFile.read()
expectedCardanoNodeVersion = re.findall(r"getCardanoNodeVersion.*([0-9]+\.[0-9]+\.[0-9]+)", body)[0]
expectedCardanoNodeVersion = re.findall(r"supportedCardanoNodeVersion.*([0-9]+\.[0-9]+\.[0-9]+)", body)[0]
print("Checking used cardano-node version")
if all(v == expectedCardanoNodeVersion for v in usedCardanoNodeVersions):
Expand Down
23 changes: 19 additions & 4 deletions hydra-cluster/test/Test/CardanoNodeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,26 @@ import Hydra.Logging (Tracer, showLogsOnFailure)
import System.Directory (doesFileExist)
import Test.Hydra.Cluster.Utils (forEachKnownNetwork)

supportedNetworks :: [KnownNetwork]
supportedNetworks = [Preview, Preproduction, Mainnet]

supportedCardanoNodeVersion :: String
supportedCardanoNodeVersion = "8.9.0"

forSupportedKnownNetworks :: String -> (KnownNetwork -> IO ()) -> Spec
forSupportedKnownNetworks msg action = forEachKnownNetwork msg $ \network -> do
unless (network `elem` supportedNetworks) $
pendingWith $
"cardano-node " <> supportedCardanoNodeVersion <> " is only supported on " ++ show supportedNetworks
action network

spec :: Spec
spec = do
-- NOTE: We also hard-code the cardano-node version here to allow prevent
-- false positives test errors in case someone uses an "untested" /
-- different than in shell.nix version of cardano-node and cardano-cli.
it "has expected cardano-node version available" $
getCardanoNodeVersion >>= (`shouldContain` "8.9.0")
getCardanoNodeVersion >>= (`shouldContain` supportedCardanoNodeVersion)

around (failAfter 5 . setupTracerAndTempDir) $ do
it "withCardanoNodeDevnet does start a block-producing devnet within 5 seconds" $ \(tr, tmp) ->
Expand All @@ -41,16 +54,18 @@ spec = do

describe "findRunningCardanoNode" $ do
it "returns Nothing on non-matching network" $ \(tr, tmp) -> do
unless (Preview `elem` supportedNetworks) $
pendingWith "Preview is not supported so skipping this test."
withCardanoNodeOnKnownNetwork tr tmp Preview $ \_ -> do
findRunningCardanoNode tr tmp Preproduction `shouldReturn` Nothing

it "returns Just running node on matching network" $ \(tr, tmp) -> do
unless (Preview `elem` supportedNetworks) $
pendingWith "Preview is not supported so skipping this test."
withCardanoNodeOnKnownNetwork tr tmp Preview $ \runningNode -> do
findRunningCardanoNode tr tmp Preview `shouldReturn` Just runningNode

forEachKnownNetwork "withCardanoNodeOnKnownNetwork starts synchronizing within 10 seconds" $ \network -> do
when (network == Sanchonet) $
pendingWith "cardano-node 8.9 not anymore supported on sanchonet"
forSupportedKnownNetworks "withCardanoNodeOnKnownNetwork starts synchronizing within 10 seconds" $ \network -> do
-- NOTE: This implies that withCardanoNodeOnKnownNetwork does not
-- synchronize the whole chain before continuing.
setupTracerAndTempDir $ \(tr, tmp) ->
Expand Down
5 changes: 5 additions & 0 deletions sample-node-config/aws/setup/hydra-team-keys.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@
"cardano-vk": "582032a1809179372d87cb118785fa9f415fd2dd2f3dda66b9fea47def53a20bed99",
"hydra-vk": "58200f23a3124d401d89e8f6cfb724eb00ac073c74edc93a4db9b0889c999f2415fe"
}
"reza": {
"peer": "87.212.22.225:5551",
"cardano-vk": "58204840c39a37560dac5c59fcc67d09f7a5be3633b8474c10c14d972ed62dc1ab19",
"hydra-vk": "5820f715cf470ad4ca7b51416c5ee2cce82f9bea9ba7fd8052bac6433a9450a39e10"
}
}

0 comments on commit ed3769f

Please sign in to comment.