clanServices: Move ergochat test to appropriate location
Move the ergochat clanService test to the ergochat clan service. The tests should live close to the definition of the service, so that debugging and discoverability is better.
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
{ lib, ... }:
|
||||
{ lib, self, ... }:
|
||||
{
|
||||
clan.modules = {
|
||||
ergochat = lib.modules.importApply ./default.nix { };
|
||||
};
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
checks = lib.optionalAttrs (pkgs.stdenv.isLinux) {
|
||||
ergochat = import ./tests/vm/default.nix {
|
||||
inherit pkgs;
|
||||
clan-core = self;
|
||||
nixosLib = import (self.inputs.nixpkgs + "/nixos/lib") { };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
51
clanServices/ergochat/tests/vm/default.nix
Normal file
51
clanServices/ergochat/tests/vm/default.nix
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
pkgs,
|
||||
nixosLib,
|
||||
clan-core,
|
||||
...
|
||||
}:
|
||||
nixosLib.runTest (
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
clan-core.modules.nixosVmTest.clanTest
|
||||
];
|
||||
|
||||
hostPkgs = pkgs;
|
||||
name = "ergochat";
|
||||
|
||||
clan = {
|
||||
directory = ./.;
|
||||
modules."@clan/ergochat" = ../../default.nix;
|
||||
inventory = {
|
||||
machines.server = { };
|
||||
|
||||
instances = {
|
||||
ergochat-test = {
|
||||
module.name = "@clan/ergochat";
|
||||
roles.default.machines."server".settings = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nodes = {
|
||||
server = { };
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
server.wait_for_unit("ergochat")
|
||||
|
||||
# Check that ergochat is running
|
||||
server.succeed("systemctl status ergochat")
|
||||
|
||||
# Check that the data directory exists
|
||||
server.succeed("test -d /var/lib/ergo")
|
||||
|
||||
# Check that the server is listening on the correct ports
|
||||
server.succeed("${pkgs.netcat}/bin/nc -z -v ::1 6667")
|
||||
'';
|
||||
}
|
||||
)
|
||||
4
clanServices/ergochat/tests/vm/sops/users/admin/key.json
Normal file
4
clanServices/ergochat/tests/vm/sops/users/admin/key.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"publickey": "age1qm0p4vf9jvcnn43s6l4prk8zn6cx0ep9gzvevxecv729xz540v8qa742eg",
|
||||
"type": "age"
|
||||
}
|
||||
Reference in New Issue
Block a user