summary refs log tree commit diff
path: root/nixos/tests/tomcat.nix
blob: c25276aa424e5911a8195dc9770bec04e21106d6 (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
{ pkgs, ... }:

{
  nodes = {
    server =
      { pkgs, config, ... }:

      {
        services.tomcat.enable = true;
        services.httpd.enable = true;
        services.httpd.adminAddr = "foo@bar.com";
        services.httpd.extraSubservices = [
          { serviceType = "tomcat-connector";
            stateDir = "/var/run/httpd";
            logDir = "/var/log/httpd";
          }
        ];
      };

    client = { };
  };

  testScript = ''
    startAll;

    $server->waitForUnit("tomcat");
    $server->sleep(30); # Dirty, but it takes a while before Tomcat handles to requests properly
    $client->waitForUnit("network.target");
    $client->succeed("curl --fail http://server/examples/servlets/servlet/HelloWorldExample");
    $client->succeed("curl --fail http://server/examples/jsp/jsp2/simpletag/hello.jsp");
  '';
}