Let's not put yet another wrapper around runTest, instead expose our logic as a module that can be imported into any nixos-vm-test
45 lines
790 B
Nix
45 lines
790 B
Nix
{
|
|
pkgs,
|
|
nixosLib,
|
|
clan-core,
|
|
module,
|
|
...
|
|
}:
|
|
nixosLib.runTest (
|
|
{ ... }:
|
|
{
|
|
imports = [
|
|
clan-core.modules.nixosVmTest.clanTest
|
|
];
|
|
|
|
hostPkgs = pkgs;
|
|
|
|
name = "hello-service";
|
|
|
|
clan = {
|
|
directory = ./.;
|
|
modules = {
|
|
hello-service = module;
|
|
};
|
|
inventory = {
|
|
machines.peer1 = { };
|
|
|
|
instances."test" = {
|
|
module.name = "hello-service";
|
|
roles.peer.machines.peer1 = { };
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript =
|
|
{ nodes, ... }:
|
|
''
|
|
start_all()
|
|
|
|
# peer1 should have the 'hello' file
|
|
value = peer1.succeed("cat ${nodes.peer1.clan.core.vars.generators.hello.files.hello.path}")
|
|
assert value.strip() == "Hello world from peer1", value
|
|
'';
|
|
}
|
|
)
|