summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorSander van der Burg <svanderburg@gmail.com>2022-03-13 14:31:43 +0100
committerSander van der Burg <svanderburg@gmail.com>2022-03-13 14:31:43 +0100
commit86fafe5f5026651ae5139f4880f177b350c8ec83 (patch)
treef0b7c3ee48bea16216cdaa0ab20fe3747bb941d4 /nixos/tests
parentd12186a6017e7fddaa0e97db90c4924485aca92c (diff)
downloadnixpkgs-86fafe5f5026651ae5139f4880f177b350c8ec83.tar
nixpkgs-86fafe5f5026651ae5139f4880f177b350c8ec83.tar.gz
nixpkgs-86fafe5f5026651ae5139f4880f177b350c8ec83.tar.bz2
nixpkgs-86fafe5f5026651ae5139f4880f177b350c8ec83.tar.lz
nixpkgs-86fafe5f5026651ae5139f4880f177b350c8ec83.tar.xz
nixpkgs-86fafe5f5026651ae5139f4880f177b350c8ec83.tar.zst
nixpkgs-86fafe5f5026651ae5139f4880f177b350c8ec83.zip
nixos/tomcat: add basic test case using the example app
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/tomcat.nix21
2 files changed, 22 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 043d8a56d0c..23116a6253d 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -524,6 +524,7 @@ in
   tinc = handleTest ./tinc {};
   tinydns = handleTest ./tinydns.nix {};
   tinywl = handleTest ./tinywl.nix {};
+  tomcat = handleTest ./tomcat.nix {};
   tor = handleTest ./tor.nix {};
   # traefik test relies on docker-containers
   traefik = handleTestOn ["x86_64-linux"] ./traefik.nix {};
diff --git a/nixos/tests/tomcat.nix b/nixos/tests/tomcat.nix
new file mode 100644
index 00000000000..e383f224e3d
--- /dev/null
+++ b/nixos/tests/tomcat.nix
@@ -0,0 +1,21 @@
+import ./make-test-python.nix ({ pkgs, ... }:
+
+{
+  name = "tomcat";
+
+  machine = { pkgs, ... }: {
+    services.tomcat.enable = true;
+  };
+
+  testScript = ''
+    machine.wait_for_unit("tomcat.service")
+    machine.wait_for_open_port(8080)
+    machine.wait_for_file("/var/tomcat/webapps/examples");
+    machine.succeed(
+        "curl --fail http://localhost:8080/examples/servlets/servlet/HelloWorldExample | grep 'Hello World!'"
+    )
+    machine.succeed(
+        "curl --fail http://localhost:8080/examples/jsp/jsp2/simpletag/hello.jsp | grep 'Hello, world!'"
+    )
+  '';
+})