about summary refs log tree commit diff
path: root/nixos/tests/gocd-agent.nix
blob: d5ed0f65ab01b8c8c0df7c3bc2a35103d6086f01 (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
32
33
34
# verifies:
#   1. GoCD agent starts
#   2. GoCD agent responds
#   3. GoCD agent is available on GoCD server using GoCD API
#     3.1. https://api.go.cd/current/#get-all-agents

import ./make-test.nix ({ pkgs, ...} : {
  name = "gocd-agent";
  meta = with pkgs.stdenv.lib.maintainers; {
    maintainers = [ swarren83 ];
  };

nodes = {
  gocd_agent =
    { config, pkgs, ... }:
    { 
      virtualisation.memorySize = 2048;
      services.gocd-agent = {
        enable = true;
      };
      services.gocd-server = {
        enable = true;
      };
    };
};

  testScript = ''
    startAll;
    $gocd_agent->waitForUnit("gocd-server");
    $gocd_agent->waitForOpenPort("8153");
    $gocd_agent->waitForUnit("gocd-agent");
    $gocd_agent->waitUntilSucceeds("curl -s -f localhost:8153/go/api/agents -H 'Accept: application/vnd.go.cd.v2+json'");
  '';
})