nixosTests.jenkins: port to python

This commit is contained in:
Robin Gloster 2019-11-24 20:54:10 +01:00
parent 4572821435
commit dde45712a7
No known key found for this signature in database
GPG Key ID: D5C458DF6DD97EDF

View File

@ -3,7 +3,7 @@
# 2. jenkins user can be extended on both master and slave
# 3. jenkins service not started on slave node
import ./make-test.nix ({ pkgs, ...} : {
import ./make-test-python.nix ({ pkgs, ...} : {
name = "jenkins";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ bjornfor coconnor domenkozar eelco ];
@ -33,18 +33,17 @@ import ./make-test.nix ({ pkgs, ...} : {
};
testScript = ''
startAll;
start_all()
$master->waitForUnit("jenkins");
master.wait_for_unit("jenkins")
$master->mustSucceed("curl http://localhost:8080 | grep 'Authentication required'");
assert "Authentication required" in master.succeed("curl http://localhost:8080")
print $master->execute("sudo -u jenkins groups");
$master->mustSucceed("sudo -u jenkins groups | grep jenkins | grep users");
for host in master, slave:
groups = host.succeed("sudo -u jenkins groups")
assert "jenkins" in groups
assert "users" in groups
print $slave->execute("sudo -u jenkins groups");
$slave->mustSucceed("sudo -u jenkins groups | grep jenkins | grep users");
$slave->mustFail("systemctl is-enabled jenkins.service");
slave.fail("systemctl is-enabled jenkins.service")
'';
})