mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-13 20:30:02 +00:00
buildkite-agent service: add test case
This commit is contained in:
parent
5869c4e45b
commit
48d6fe551d
3 changed files with 27 additions and 1 deletions
|
@ -186,7 +186,8 @@ in
|
|||
|
||||
launchd.daemons.buildkite-agent =
|
||||
{
|
||||
path = cfg.runtimePackages ++ [ pkgs.coreutils pkgs.darwin.DarwinTools cfg.package ];
|
||||
path = cfg.runtimePackages ++ [ pkgs.coreutils cfg.package ]
|
||||
++ (if pkgs.stdenv.isDarwin then [ pkgs.darwin.DarwinTools ] else []);
|
||||
environment = {
|
||||
HOME = cfg.dataDir;
|
||||
NIX_SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
|
|
|
@ -105,6 +105,7 @@ let
|
|||
tests.system-path-fish = makeTest ./tests/system-path-fish.nix;
|
||||
tests.system-shells = makeTest ./tests/system-shells.nix;
|
||||
tests.users-groups = makeTest ./tests/users-groups.nix;
|
||||
tests.buildkite-agent = makeTest ./tests/buildkite-agent.nix;
|
||||
|
||||
}
|
||||
// (mapTestOn (packagePlatforms packageSet));
|
||||
|
|
24
tests/buildkite-agent.nix
Normal file
24
tests/buildkite-agent.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
tokenPath = pkgs.writeText "buildkite_token" "TEST_TOKEN";
|
||||
in {
|
||||
services.buildkite-agent = {
|
||||
enable = true;
|
||||
extraConfig = "yolo=1";
|
||||
openssh.privateKeyPath = "/dev/null";
|
||||
openssh.publicKeyPath = "/dev/null";
|
||||
hooks.command = "echo test";
|
||||
inherit tokenPath;
|
||||
};
|
||||
|
||||
test = ''
|
||||
echo "checking buildkite-agent service in /Library/LaunchDaemons" >&2
|
||||
grep "org.nixos.buildkite-agent" ${config.out}/Library/LaunchDaemons/org.nixos.buildkite-agent.plist
|
||||
|
||||
echo "checking creation of buildkite-agent service config" >&2
|
||||
script=$(cat ${config.out}/Library/LaunchDaemons/org.nixos.buildkite-agent.plist | awk -F'[< ]' '$3 ~ "^/nix/store/.*" {print $3}')
|
||||
grep "yolo=1" "$script"
|
||||
grep "${tokenPath}" "$script"
|
||||
'';
|
||||
}
|
Loading…
Add table
Reference in a new issue