Merge pull request #163716 from svanderburg/fixtomcat

nixos/tomcat: configure default group and fix broken default package …
This commit is contained in:
Sander van der Burg 2022-03-13 21:43:45 +01:00 committed by GitHub
commit 43543a6bbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 3 deletions

View File

@ -23,8 +23,8 @@ in
package = mkOption {
type = types.package;
default = pkgs.tomcat85;
defaultText = literalExpression "pkgs.tomcat85";
default = pkgs.tomcat9;
defaultText = literalExpression "pkgs.tomcat9";
example = lib.literalExpression "pkgs.tomcat9";
description = ''
Which tomcat package to use.
@ -127,7 +127,7 @@ in
webapps = mkOption {
type = types.listOf types.path;
default = [ tomcat.webapps ];
defaultText = literalExpression "[ pkgs.tomcat85.webapps ]";
defaultText = literalExpression "[ config.services.tomcat.package.webapps ]";
description = "List containing WAR files or directories with WAR files which are web applications to be deployed on Tomcat";
};
@ -201,6 +201,7 @@ in
{ uid = config.ids.uids.tomcat;
description = "Tomcat user";
home = "/homeless-shelter";
group = "tomcat";
extraGroups = cfg.extraGroups;
};

View File

@ -525,6 +525,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 {};

21
nixos/tests/tomcat.nix Normal file
View File

@ -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!'"
)
'';
})