nixpkgs/nixos/tests/jenkins.nix

50 lines
1.1 KiB
Nix
Raw Normal View History

# verifies:
# 1. jenkins service starts on master node
# 2. jenkins user can be extended on both master and slave
# 3. jenkins service not started on slave node
2019-11-24 19:54:10 +00:00
import ./make-test-python.nix ({ pkgs, ...} : {
2014-06-28 15:04:49 +01:00
name = "jenkins";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ bjornfor coconnor domenkozar eelco ];
};
nodes = {
master =
{ ... }:
{ services.jenkins.enable = true;
# should have no effect
services.jenkinsSlave.enable = true;
users.users.jenkins.extraGroups = [ "users" ];
systemd.services.jenkins.serviceConfig.TimeoutStartSec = "6min";
};
slave =
{ ... }:
{ services.jenkinsSlave.enable = true;
users.users.jenkins.extraGroups = [ "users" ];
};
};
testScript = ''
2019-11-24 19:54:10 +00:00
start_all()
2019-11-24 19:54:10 +00:00
master.wait_for_unit("jenkins")
2019-11-24 19:54:10 +00:00
assert "Authentication required" in master.succeed("curl http://localhost:8080")
2019-11-24 19:54:10 +00:00
for host in master, slave:
groups = host.succeed("sudo -u jenkins groups")
assert "jenkins" in groups
assert "users" in groups
2019-11-24 19:54:10 +00:00
slave.fail("systemctl is-enabled jenkins.service")
'';
})