clanServices: Move heisenbridge test to appropriate location
Move the heisenbridge clanService test to the heisenbridge 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 = {
|
||||
heisenbridge = lib.modules.importApply ./default.nix { };
|
||||
};
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
checks = lib.optionalAttrs (pkgs.stdenv.isLinux) {
|
||||
heisenbridge = import ./tests/vm/default.nix {
|
||||
inherit pkgs;
|
||||
clan-core = self;
|
||||
nixosLib = import (self.inputs.nixpkgs + "/nixos/lib") { };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
65
clanServices/heisenbridge/tests/vm/default.nix
Normal file
65
clanServices/heisenbridge/tests/vm/default.nix
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
pkgs,
|
||||
nixosLib,
|
||||
clan-core,
|
||||
...
|
||||
}:
|
||||
|
||||
nixosLib.runTest (
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
clan-core.modules.nixosVmTest.clanTest
|
||||
];
|
||||
|
||||
hostPkgs = pkgs;
|
||||
|
||||
name = "heisenbridge";
|
||||
|
||||
clan = {
|
||||
directory = ./.;
|
||||
modules."@clan/heisenbridge" = ../../default.nix;
|
||||
inventory = {
|
||||
machines.server = { };
|
||||
|
||||
instances = {
|
||||
heisenbridge-test = {
|
||||
module.name = "@clan/heisenbridge";
|
||||
roles.default.machines."server".settings = {
|
||||
homeserver = "http://127.0.0.1:8008";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nodes = {
|
||||
server = {
|
||||
# Setup a minimal matrix-synapse to test with
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
settings.server_name = "example.com";
|
||||
settings.database = {
|
||||
name = "sqlite3";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
server.wait_for_unit("matrix-synapse")
|
||||
server.wait_for_unit("heisenbridge")
|
||||
|
||||
# Check that heisenbridge is running
|
||||
server.succeed("systemctl status heisenbridge")
|
||||
|
||||
# Wait for the bridge to initialize
|
||||
server.wait_until_succeeds("journalctl -u heisenbridge | grep -q 'bridge is now running'")
|
||||
|
||||
# Check that heisenbridge is listening on the default port
|
||||
server.succeed("${pkgs.netcat}/bin/nc -z -v 127.0.0.1 9898")
|
||||
'';
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"publickey": "age1qm0p4vf9jvcnn43s6l4prk8zn6cx0ep9gzvevxecv729xz540v8qa742eg",
|
||||
"type": "age"
|
||||
}
|
||||
Reference in New Issue
Block a user