Skip to content

Commit

Permalink
postgresqlPackages.tsja: make passthru.tests work with correct package
Browse files Browse the repository at this point in the history
Same reasoning as commit before.
  • Loading branch information
wolfgangwalther committed Nov 1, 2024
1 parent 12e76b5 commit eab4f14
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 29 deletions.
69 changes: 41 additions & 28 deletions nixos/tests/tsja.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@
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, ... }:
let
makeTsjaTest = postgresqlPackage:
import ./make-test-python.nix ({ pkgs, lib, ...} : {
name = "tsja-${postgresqlPackage.name}";
meta = {
maintainers = with lib.maintainers; [ chayleaf ];
};

nodes = {
master =
{ config, ... }:

{
services.postgresql = {
enable = true;
extraPlugins = ps: with ps; [
tsja
];
};
{
services.postgresql = {
enable = true;
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 "{日本語}"
""")
'';
})
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
{
default = makeTsjaTest pkgs.postgresql;
jit = makeTsjaTest pkgs.postgresql_jit;
passthru.override = p: makeTsjaTest p;
}
2 changes: 1 addition & 1 deletion pkgs/servers/sql/postgresql/ext/tsja.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit eab4f14

Please sign in to comment.