summary refs log tree commit diff
path: root/nixos/tests/phabricator.nix
blob: 0fe31f66502d5a87346ee524a183fa3a7d9caaaf (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import ./make-test.nix ({ pkgs, ... }: {
  name = "phabricator";

  nodes = {
    storage =
      { config, pkgs, ... }:
      { services.nfs.server.enable = true;
        services.nfs.server.exports = ''
          /repos 192.168.1.0/255.255.255.0(rw,no_root_squash)
        '';
        services.nfs.server.createMountPoints = true;
      };

    webserver =
      { config, pkgs, ... }:
      { fileSystems = pkgs.lib.mkVMOverride
          [ { mountPoint = "/repos";
              device = "storage:/repos";
              fsType = "nfs";
            }
          ];
        networking.firewall.enable = false;
        networking.useDHCP = false;

        services = {
          httpd = {
            enable = true;
            adminAddr = "root@localhost";
            virtualHosts = [{
              hostName = "phabricator.local";
              extraSubservices = [{serviceType = "phabricator";}];
            }];
          };

          phd = {
            enable = true;
          };

          mysql = {
            enable = true;
            package = pkgs.mysql;
            extraOptions = ''
              sql_mode=STRICT_ALL_TABLES
            '';
          };
        };

        environment.systemPackages = [ pkgs.php ];
      };

    client =
      { config, pkgs, ... }:
      { imports = [ ./common/x11.nix ];
        services.xserver.desktopManager.kde4.enable = true;
      };
  };

  testScript =
    ''
      startAll;

      $client->waitForX;

      $webserver->waitForUnit("mysql");
      $webserver->waitForUnit("httpd");
      $webserver->execute("cd /nix/store; less >/repos/log1");

      $client->sleep(30); # loading takes a long time
      $client->execute("konqueror http://webserver/ &");
      $client->sleep(90); # loading takes a long time

      $client->screenshot("screen");
    '';
})