nixpkgs/nixos/tests/jenkins.nix
Dominik Xaver Hörl 25bef2d8f9 treewide: simplify pkgs.stdenv.lib -> pkgs.lib
The library does not depend on stdenv, that `stdenv` exposes `lib` is
an artifact of the ancient origins of nixpkgs.
2021-01-10 20:12:06 +01:00

50 lines
1.1 KiB
Nix

# 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
import ./make-test-python.nix ({ pkgs, ...} : {
name = "jenkins";
meta = with pkgs.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 = ''
start_all()
master.wait_for_unit("jenkins")
assert "Authentication required" in master.succeed("curl http://localhost:8080")
for host in master, slave:
groups = host.succeed("sudo -u jenkins groups")
assert "jenkins" in groups
assert "users" in groups
slave.fail("systemctl is-enabled jenkins.service")
'';
})