summaryrefslogtreecommitdiffstats
path: root/nixos/tests/tomcat.nix
blob: a025f54b803585bfa6d3f089040d00a8c43ccd07 (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
{ lib, pkgs, ... }:
{
  name = "tomcat";
  meta.maintainers = [ lib.maintainers.anthonyroussel ];

  nodes.machine =
    { pkgs, ... }:
    {
      services.tomcat = {
        enable = true;
        port = 8001;
        axis2.enable = true;
      };
    };

  testScript = ''
    machine.wait_for_unit("tomcat.service")
    machine.wait_for_open_port(8001)
    machine.wait_for_file("/var/tomcat/webapps/examples");

    machine.succeed(
        "curl -sS --fail http://localhost:8001/examples/servlets/servlet/HelloWorldExample | grep 'Hello World!'"
    )
    machine.succeed(
        "curl -sS --fail http://localhost:8001/examples/jsp/jsp2/simpletag/hello.jsp | grep 'Hello, world!'"
    )
    machine.succeed(
        "curl -sS --fail http://localhost:8001/axis2/axis2-web/HappyAxis.jsp | grep 'Found Axis2'"
    )
  '';
}