diff --git a/nixos/tests/tsja.nix b/nixos/tests/tsja.nix index f34358ff3f5f3..b668b4aa9ae61 100644 --- a/nixos/tests/tsja.nix +++ b/nixos/tests/tsja.nix @@ -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; +} diff --git a/pkgs/servers/sql/postgresql/ext/tsja.nix b/pkgs/servers/sql/postgresql/ext/tsja.nix index f0b9238f59ef2..38df785e7f7c3 100644 --- a/pkgs/servers/sql/postgresql/ext/tsja.nix +++ b/pkgs/servers/sql/postgresql/ext/tsja.nix @@ -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";