about summary refs log tree commit diff
path: root/nixos/tests/tsja.nix
blob: f34358ff3f5f3113fa389b6dd1faaa1da839a69e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import ./make-test-python.nix ({ pkgs, lib, ...} : {
  name = "tsja";
  meta = {
    maintainers = with lib.maintainers; [ chayleaf ];
  };

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

      {
        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 "{日本語}"
    """)
  '';
})