Merge pull request #74082 from flokli/nixos-test-port-gocd
nixosTest.gocd-{agent,server}: port to python
This commit is contained in:
commit
c7d0ee722d
2 changed files with 29 additions and 21 deletions
|
@ -9,14 +9,18 @@ let
|
|||
header = "Accept: application/vnd.go.cd.v2+json";
|
||||
in
|
||||
|
||||
import ./make-test.nix ({ pkgs, ...} : {
|
||||
import ./make-test-python.nix ({ pkgs, ...} : {
|
||||
name = "gocd-agent";
|
||||
meta = with pkgs.stdenv.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 = {
|
||||
gocd_agent =
|
||||
agent =
|
||||
{ ... }:
|
||||
{
|
||||
virtualisation.memorySize = 2046;
|
||||
|
@ -30,11 +34,15 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
$gocd_agent->waitForUnit("gocd-server");
|
||||
$gocd_agent->waitForOpenPort("8153");
|
||||
$gocd_agent->waitForUnit("gocd-agent");
|
||||
$gocd_agent->waitUntilSucceeds("curl ${serverUrl} -H '${header}' | ${pkgs.jq}/bin/jq -e ._embedded.agents[0].uuid");
|
||||
$gocd_agent->succeed("curl ${serverUrl} -H '${header}' | ${pkgs.jq}/bin/jq -e ._embedded.agents[0].agent_state | grep -q Idle");
|
||||
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 -q Idle"
|
||||
)
|
||||
'';
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# 1. GoCD server starts
|
||||
# 2. GoCD server responds
|
||||
|
||||
import ./make-test.nix ({ pkgs, ...} :
|
||||
import ./make-test-python.nix ({ pkgs, ...} :
|
||||
|
||||
{
|
||||
name = "gocd-server";
|
||||
|
@ -11,7 +11,7 @@ import ./make-test.nix ({ pkgs, ...} :
|
|||
};
|
||||
|
||||
nodes = {
|
||||
gocd_server =
|
||||
server =
|
||||
{ ... }:
|
||||
{
|
||||
virtualisation.memorySize = 2046;
|
||||
|
@ -20,9 +20,9 @@ nodes = {
|
|||
};
|
||||
|
||||
testScript = ''
|
||||
$gocd_server->start;
|
||||
$gocd_server->waitForUnit("gocd-server");
|
||||
$gocd_server->waitForOpenPort("8153");
|
||||
$gocd_server->waitUntilSucceeds("curl -s -f localhost:8153/go");
|
||||
server.start()
|
||||
server.wait_for_unit("gocd-server")
|
||||
server.wait_for_open_port(8153)
|
||||
server.wait_until_succeeds("curl -s -f localhost:8153/go")
|
||||
'';
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue