postgresqlPackages.tsja: make passthru.tests work with correct package

Same reasoning as commit before.
This commit is contained in:
Wolfgang Walther 2024-11-01 19:49:55 +01:00
parent a5c41ae80a
commit 6d7da20a90
No known key found for this signature in database
GPG Key ID: B39893FA5F65CAE1
2 changed files with 44 additions and 29 deletions

View File

@ -1,32 +1,47 @@
import ./make-test-python.nix ({ pkgs, lib, ...} : {
name = "tsja";
meta = {
maintainers = with lib.maintainers; [ chayleaf ];
};
{ system ? builtins.currentSystem
, config ? {}
, pkgs ? import ../.. { inherit system config; }
}:
nodes = {
master =
{ config, ... }:
with import ../lib/testing-python.nix { inherit system pkgs; };
{
services.postgresql = {
enable = true;
extraPlugins = ps: with ps; [
tsja
];
};
let
makeTsjaTest = postgresqlPackage:
makeTest {
name = "tsja-${postgresqlPackage.name}";
meta = {
maintainers = with lib.maintainers; [ chayleaf ];
};
};
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 "{}"
""")
'';
})
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.concatMapAttrs (n: p: { ${n} = makeTsjaTest p; }) pkgs.postgresqlVersions
// {
passthru.override = p: makeTsjaTest p;
}

View File

@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
mv dbinit_libtsja.txt $out/share/postgresql/extension/libtsja_dbinit.sql
'';
passthru.tests.tsja = nixosTests.tsja;
passthru.tests = nixosTests.tsja.passthru.override postgresql;
meta = with lib; {
description = "PostgreSQL extension implementing Japanese text search";