nixpkgs/nixos/tests/tomcat.nix
Eelco Dolstra abe218950c Make it easier to run the tests
You can now run a test in the nixos/tests directory directly using
nix-build, e.g.

  $ nix-build '<nixos/tests/login.nix>' -A test

This gets rid of having to add the test to nixos/tests/default.nix.
(Of course, you still need to add it to nixos/release.nix if you want
Hydra to run the test.)
2014-04-14 14:02:44 +02:00

28 lines
794 B
Nix

import ./make-test.nix {
nodes = {
server =
{ pkgs, config, ... }:
{ services.tomcat.enable = true;
services.httpd.enable = true;
services.httpd.adminAddr = "foo@bar.com";
services.httpd.extraSubservices =
[ { serviceType = "tomcat-connector"; } ];
networking.firewall.allowedTCPPorts = [ 80 ];
};
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");
'';
}