abe218950c
You can now run a test in the nixos/tests directory directly using nix-build, e.g. $ nix-build '<nixos/tests/login.nix>' -A test This gets rid of having to add the test to nixos/tests/default.nix. (Of course, you still need to add it to nixos/release.nix if you want Hydra to run the test.)
42 lines
1,005 B
Nix
42 lines
1,005 B
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.nix {
|
|
|
|
nodes = {
|
|
|
|
master =
|
|
{ config, pkgs, ... }:
|
|
{ services.jenkins.enable = true;
|
|
|
|
# should have no effect
|
|
services.jenkinsSlave.enable = true;
|
|
|
|
users.extraUsers.jenkins.extraGroups = [ "users" ];
|
|
};
|
|
|
|
slave =
|
|
{ config, pkgs, ... }:
|
|
{ services.jenkinsSlave.enable = true;
|
|
|
|
users.extraUsers.jenkins.extraGroups = [ "users" ];
|
|
};
|
|
|
|
};
|
|
|
|
testScript = ''
|
|
startAll;
|
|
|
|
$master->waitForUnit("jenkins");
|
|
print $master->execute("sudo -u jenkins groups");
|
|
$master->mustSucceed("sudo -u jenkins groups | grep jenkins | grep users");
|
|
|
|
print $slave->execute("sudo -u jenkins groups");
|
|
$slave->mustSucceed("sudo -u jenkins groups | grep jenkins | grep users");
|
|
|
|
$slave->mustFail("systemctl status jenkins.service");
|
|
'';
|
|
}
|