Merge pull request #24 from Mic92/fixes

add integration test for worker
This commit is contained in:
Jörg Thalheim 2023-11-04 13:54:54 +01:00 committed by GitHub
commit 9884c25e94
Failed to generate hash of commit
3 changed files with 28 additions and 0 deletions

View file

@ -10,6 +10,7 @@
in in
{ {
master = import ./master.nix checkArgs; master = import ./master.nix checkArgs;
worker = import ./worker.nix checkArgs;
}; };
}; };
} }

21
nix/checks/worker.nix Normal file
View file

@ -0,0 +1,21 @@
(import ./lib.nix) {
name = "from-nixos";
nodes = {
# `self` here is set by using specialArgs in `lib.nix`
node1 = { self, config, pkgs, ... }: {
imports = [
self.nixosModules.buildbot-worker
];
services.buildbot-nix.worker = {
enable = true;
workerPasswordFile = pkgs.writeText "password" "password";
};
};
};
# This is the test code that will check if our service is running correctly:
testScript = ''
start_all()
# wait for our service to start
node1.wait_for_unit("buildbot-worker")
'';
}

View file

@ -32,6 +32,12 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
nix.settings.extra-allowed-users = [ "buildbot-worker" ]; nix.settings.extra-allowed-users = [ "buildbot-worker" ];
# Allow buildbot-worker to create gcroots
systemd.tmpfiles.rules = [
"d /nix/var/nix/gcroots/per-user/${config.users.users.buildbot-worker.name} 0755 ${config.users.users.buildbot-worker.name} root - -"
];
users.users.buildbot-worker = { users.users.buildbot-worker = {
description = "Buildbot Worker User."; description = "Buildbot Worker User.";
isSystemUser = true; isSystemUser = true;