nixos/modules/jenkins: Test the CLI

Signed-off-by: Pamplemousse <xav.maso@gmail.com>
(cherry picked from commit 4f093b8fdb3e6b7102ad99089712beca2ae49abb)
This commit is contained in:
Pamplemousse 2021-07-04 14:49:39 -07:00 committed by Bjørn Forsman
parent 3b60f6b0fd
commit 30048c7078
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
import ./make-test-python.nix ({ pkgs, ...} : rec {
name = "jenkins-cli";
meta = with pkgs.lib.maintainers; {
maintainers = [ pamplemousse ];
};
nodes = {
machine =
{ ... }:
{
services.jenkins = {
enable = true;
withCLI = true;
};
};
};
testScript = ''
start_all()
machine.wait_for_unit("jenkins")
assert "JENKINS_URL" in machine.succeed("env")
assert "http://0.0.0.0:8080" in machine.succeed("echo $JENKINS_URL")
machine.succeed(
"jenkins-cli -auth admin:$(cat /var/lib/jenkins/secrets/initialAdminPassword)"
)
'';
})