summary refs log tree commit diff
path: root/nixos/tests/buildkite-agents.nix
blob: 6674a0e884ed35f8019a9ed2af01a7e95b8843f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import ./make-test-python.nix ({ pkgs, ... }:

{
  name = "buildkite-agent";
  meta = with pkgs.lib.maintainers; {
    maintainers = [ flokli ];
  };

  machine = { pkgs, ... }: {
    services.buildkite-agents = {
      one = {
        privateSshKeyPath = (import ./ssh-keys.nix pkgs).snakeOilPrivateKey;
        tokenPath = (pkgs.writeText "my-token" "5678");
      };
      two = {
        tokenPath = (pkgs.writeText "my-token" "1234");
      };
    };
  };

  testScript = ''
    start_all()
    # we can't wait on the unit to start up, as we obviously can't connect to buildkite,
    # but we can look whether files are set up correctly

    machine.wait_for_file("/var/lib/buildkite-agent-one/buildkite-agent.cfg")
    machine.wait_for_file("/var/lib/buildkite-agent-one/.ssh/id_rsa")

    machine.wait_for_file("/var/lib/buildkite-agent-two/buildkite-agent.cfg")
  '';
})