about summary refs log tree commit diff
path: root/nixos/tests/tsja.nix
diff options
context:
space:
mode:
authorchayleaf <chayleaf-git@pavluk.org>2023-10-20 14:41:34 +0700
committerchayleaf <chayleaf-git@pavluk.org>2023-10-27 01:09:48 +0700
commit47646a34bae848c4a6869c41ff544be6c4cdb7a4 (patch)
tree21515754fe3dd4261a3da85c4059d8318026fa75 /nixos/tests/tsja.nix
parenta190bf43b618e0bbc8cc5cd2310ae2a03f307190 (diff)
postgresqlPackages.tsja: init at 0.5.0
Diffstat (limited to 'nixos/tests/tsja.nix')
-rw-r--r--nixos/tests/tsja.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/nixos/tests/tsja.nix b/nixos/tests/tsja.nix
new file mode 100644
index 0000000000000..176783088d8d5
--- /dev/null
+++ b/nixos/tests/tsja.nix
@@ -0,0 +1,32 @@
+import ./make-test-python.nix ({ pkgs, lib, ...} : {
+  name = "tsja";
+  meta = {
+    maintainers = with lib.maintainers; [ chayleaf ];
+  };
+
+  nodes = {
+    master =
+      { config, ... }:
+
+      {
+        services.postgresql = {
+          enable = true;
+          extraPlugins = with config.services.postgresql.package.pkgs; [
+            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 "{日本語}"
+    """)
+  '';
+})