hello-world: migrate to clan.nixosTests module
This commit is contained in:
@@ -14,7 +14,7 @@ in
|
|||||||
hello-world = module;
|
hello-world = module;
|
||||||
};
|
};
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, ... }:
|
{ ... }:
|
||||||
let
|
let
|
||||||
# Module that contains the tests
|
# Module that contains the tests
|
||||||
# This module adds:
|
# This module adds:
|
||||||
@@ -41,15 +41,10 @@ in
|
|||||||
2. To run the test
|
2. To run the test
|
||||||
nix build .#checks.x86_64-linux.hello-service
|
nix build .#checks.x86_64-linux.hello-service
|
||||||
*/
|
*/
|
||||||
checks =
|
clan.nixosTests.hello-service = {
|
||||||
# Currently we don't support nixos-integration tests on darwin
|
imports = [ ./tests/vm/default.nix ];
|
||||||
lib.optionalAttrs (pkgs.stdenv.isLinux) {
|
|
||||||
hello-service = import ./tests/vm/default.nix {
|
clan.modules.hello-service = module;
|
||||||
inherit module;
|
};
|
||||||
inherit self inputs pkgs;
|
|
||||||
nixosLib = import (self.inputs.nixpkgs + "/nixos/lib") { };
|
|
||||||
clan-core = self;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,44 +1,29 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
|
||||||
nixosLib,
|
|
||||||
clan-core,
|
|
||||||
module,
|
module,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
nixosLib.runTest (
|
{
|
||||||
{ ... }:
|
name = "hello-service";
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
clan-core.modules.nixosVmTest.clanTest
|
|
||||||
];
|
|
||||||
|
|
||||||
hostPkgs = pkgs;
|
clan = {
|
||||||
|
directory = ./.;
|
||||||
|
inventory = {
|
||||||
|
machines.peer1 = { };
|
||||||
|
|
||||||
name = "hello-service";
|
instances."test" = {
|
||||||
|
module.name = "hello-service";
|
||||||
clan = {
|
roles.peer.machines.peer1 = { };
|
||||||
directory = ./.;
|
|
||||||
modules = {
|
|
||||||
hello-service = module;
|
|
||||||
};
|
|
||||||
inventory = {
|
|
||||||
machines.peer1 = { };
|
|
||||||
|
|
||||||
instances."test" = {
|
|
||||||
module.name = "hello-service";
|
|
||||||
roles.peer.machines.peer1 = { };
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
testScript =
|
testScript =
|
||||||
{ nodes, ... }:
|
{ nodes, ... }:
|
||||||
''
|
''
|
||||||
start_all()
|
start_all()
|
||||||
|
|
||||||
# peer1 should have the 'hello' file
|
# peer1 should have the 'hello' file
|
||||||
value = peer1.succeed("cat ${nodes.peer1.clan.core.vars.generators.hello.files.hello.path}")
|
value = peer1.succeed("cat ${nodes.peer1.clan.core.vars.generators.hello.files.hello.path}")
|
||||||
assert value.strip() == "Hello world from peer1", value
|
assert value.strip() == "Hello world from peer1", value
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user