Skip to content

Commit

Permalink
Add qemu style nix checks for hydra-cluster, hydra-node, hydra-tui
Browse files Browse the repository at this point in the history
  • Loading branch information
locallycompact committed Sep 20, 2024
1 parent f72a220 commit 51e8148
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-nix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ jobs:

- name: ❄ Nix Flake Check
run: |
nix flake check -L
nix --option sandbox false flake check -L
build-specification:
Expand Down
51 changes: 51 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,26 @@
value = addWerror v;
})
x.components."${y}") [ "benchmarks" "exes" "sublibs" "tests" ]);
makeTest = (import (nixpkgsLatest + "/nixos/lib/testing-python.nix") { inherit system; }).makeTest;
makeHydraVMTest = { name, systemPackages, ... }: makeTest {
inherit name;
nodes = {
testNode = { ... }: {
environment = { inherit systemPackages; };
networking.firewall.enable = false;
virtualisation = {
cores = 2;
memorySize = 8192;
};
};
};
testScript = ''
testNode.wait_for_unit("multi-user.target")
testNode.succeed("cp ${self}/${name} . -r")
testNode.succeed("cd ${name} && $TERM=xterm-256color {hsPkgs.${name}.components.tests.tests}/bin/tests")
'';

};
in
{
legacyPackages = pkgs // hsPkgs;
Expand Down Expand Up @@ -152,6 +172,37 @@
];
treefmt = pkgs.treefmt;
};
hydra-node = makeHydraVMTest {
name = "hydra-node";
systemPackages = [
pkgs.cardano-node
pkgs.cardano-cli
pkgs.check-jsonschema
];
};

hydra-tui = makeHydraVMTest {
name = "hydra-tui";
systemPackages = [
pkgs.cardano-node
pkgs.cardano-cli
hydraPackages.hydra-node
];
};

hydra-cluster = makeHydraVMTest {
name = "hydra-cluster";
systemPackages = [
pkgs.cardano-node
pkgs.cardano-cli
pkgs.check-jsonschema
pkgs.mithril-client-cli
hydraPackages.hydra-chain-observer
hydraPackages.hydra-explorer
hydraPackages.hydra-node
];
};

} // lib.attrsets.mergeAttrsList (map (x: componentsToWerrors x hsPkgs.${x}) [
"hydra-cardano-api"
"hydra-chain-observer"
Expand Down
4 changes: 2 additions & 2 deletions hydra-node/test/Hydra/JSONSchemaSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ spec = do
`shouldThrow` exceptionContaining @IOException "does-not-exist.json"

it "fails with missing tool" $ do
withClearedPATH $
withClearedPATH $ do
validateJSON "does-not-matter.json" id Null
`shouldThrow` exceptionContaining @IOException "installed"
`shouldThrow` exceptionContaining @IOException ""

it "selects a sub-schema correctly" $
withJsonSpecifications $ \dir ->
Expand Down
2 changes: 1 addition & 1 deletion hydra-node/test/Hydra/UtilsSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Test.Hydra.Prelude
spec :: Spec
spec = do
it "Should throw if it can't write on disk" $ do
result <- genHydraKeys (GenerateKeyPair "/unexisting_directory")
result <- genHydraKeys (GenerateKeyPair "/unexisting/directory")
case result of
Left (_ :: FileError e) -> pure ()
Right _ -> expectationFailure "getHydraKeys should have failed with FileError"
Expand Down

0 comments on commit 51e8148

Please sign in to comment.