nixpkgs/nixos/tests/postgresql/tsja.nix
Wolfgang Walther 9035573855
nixosTests.postgresql: move all postgresql related nixosTests into one folder
This makes it possible to run all those tests at once by building
nixosTests.postgresql and allow a simple entry to ci/OWNERS for all
tests.
2024-11-09 18:24:52 +01:00

46 lines
1.2 KiB
Nix

{ pkgs
, makeTest
}:
let
makeTsjaTest = postgresqlPackage:
makeTest {
name = "tsja-${postgresqlPackage.name}";
meta = {
maintainers = with lib.maintainers; [ chayleaf ];
};
nodes = {
master =
{ config, ... }:
{
services.postgresql = {
enable = true;
package = postgresqlPackage;
extraPlugins = ps: with ps; [
tsja
];
};
};
};
testScript = ''
start_all()
master.wait_for_unit("postgresql")
master.succeed("sudo -u postgres psql -f /run/current-system/sw/share/postgresql/extension/libtsja_dbinit.sql")
# make sure "" is parsed as a separate lexeme
master.succeed("""
sudo -u postgres \\
psql -c "SELECT * FROM ts_debug('japanese', 'PostgreSQL')" \\
| grep "{}"
""")
'';
};
in
pkgs.lib.recurseIntoAttrs (
pkgs.lib.concatMapAttrs (n: p: { ${n} = makeTsjaTest p; }) pkgs.postgresqlVersions
// {
passthru.override = p: makeTsjaTest p;
}
)