nixpkgs/nixos/tests/gocd-agent.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

55 lines
1.4 KiB
Nix

# 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
let
serverUrl = "localhost:8153/go/api/agents";
header = "Accept: application/vnd.go.cd.v2+json";
in
import ./make-test-python.nix (
{ pkgs, ... }:
{
name = "gocd-agent";
meta = with pkgs.lib.maintainers; {
maintainers = [
grahamc
swarren83
];
# gocd agent needs to register with the autoregister key created on first server startup,
# but NixOS module doesn't seem to allow to pass during runtime currently
broken = true;
};
nodes = {
agent =
{ ... }:
{
virtualisation.memorySize = 2046;
services.gocd-agent = {
enable = true;
};
services.gocd-server = {
enable = true;
};
};
};
testScript = ''
start_all()
agent.wait_for_unit("gocd-server")
agent.wait_for_open_port(8153)
agent.wait_for_unit("gocd-agent")
agent.wait_until_succeeds(
"curl ${serverUrl} -H '${header}' | ${pkgs.jq}/bin/jq -e ._embedded.agents[0].uuid"
)
agent.succeed(
"curl ${serverUrl} -H '${header}' | ${pkgs.jq}/bin/jq -e ._embedded.agents[0].agent_state | grep Idle"
)
'';
}
)