summary refs log tree commit diff
path: root/nixos/tests/tomcat.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/tests/tomcat.nix')
-rw-r--r--nixos/tests/tomcat.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/nixos/tests/tomcat.nix b/nixos/tests/tomcat.nix
new file mode 100644
index 00000000000..c25276aa424
--- /dev/null
+++ b/nixos/tests/tomcat.nix
@@ -0,0 +1,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");
+  '';
+}