summaryrefslogtreecommitdiffstats
path: root/nixos/tests/odoo/multi-process.nix
blob: f73a37a5c9a6f97906b4cd9eddf4dbd0549d19d2 (plain)
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
33
34
35
36
37
38
39
{
  package,
  lib,
  ...
}:
{
  name = "odoo-multi-process";
  meta.maintainers = with lib.maintainers; [
    mkg20001
    xanderio
  ];

  nodes.server = {
    services.nginx = {
      enable = true;
      recommendedProxySettings = true;
    };

    services.odoo = {
      enable = true;
      package = package;
      autoInit = true;
      autoInitExtraFlags = [ "--without-demo=all" ];
      domain = "localhost";
      settings.options.workers = 2;
    };
  };

  testScript = # python
    ''
      server.wait_for_unit("odoo.service")
      server.wait_until_succeeds(
        "test $(journalctl -u odoo | grep -o 'Worker WorkerHTTP ([[:digit:]]*) alive' | wc -l) = 2"
      )
      server.wait_until_succeeds("curl -s http://localhost:8069/web/database/selector | grep '<title>Odoo</title>'")
      server.succeed("curl -s http://localhost/web/database/selector | grep '<title>Odoo</title>'")
      server.succeed("curl http://localhost/web/database/manager | grep 'database manager has been disabled'")
    '';
}