add basic test for postgresql

This commit is contained in:
Charlotte 🦝 Delenk 2024-04-13 14:05:50 +01:00
parent 4b3ca4ee01
commit 3ad91bd9b5
4 changed files with 38 additions and 1 deletions

View file

@ -284,6 +284,17 @@ rec {
# Uncomment the line to build an installer image
# This is EXTREMELY LARGE and will make builds take forever
# installer.x86_64-linux = nixosConfigurations.installer.config.system.build.isoImage;
tests = let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [
self.overlays.x86_64-linux
args.nix-packages.overlays.x86_64-linux.default
];
};
in {
postgresql = pkgs.callPackage ./new-infra/containers/postgresql/test.nix {};
};
};
};
}

View file

@ -35,6 +35,14 @@
enable = true;
};
system.stateVersion = "24.05";
systemd.tmpfiles.rules = [
"d /persist - postgresql postgresql - -"
"d /backup - postgresql postgresql - -"
];
};
};
systemd.tmpfiles.rules = [
"d /persist/postgresql - - - - -"
"d /persist/backup/postgresql - - - - -"
];
}

View file

@ -0,0 +1,18 @@
{pkgs ? import <nixpkgs> {}, ...}:
pkgs.testers.runNixOSTest {
name = "postgresql";
nodes.postgresql = {
config,
pkgs,
...
}: {
imports = [
./default.nix
];
system.stateVersion = "23.11";
};
testScript = ''
postgresql.wait_for_unit("container@postgresql.service")
'';
}

View file

@ -1,5 +1,5 @@
{
imports = [
../containers/postgresql.nix # TODO
../containers/postgresql/default.nix # TODO
];
}