From 46daafa269be76d47114ae0ba84d8ace7217c06d Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 24 Nov 2019 22:48:59 +0100 Subject: [PATCH] nixosTest.gocd-agent: port to python --- nixos/tests/gocd-agent.nix | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/nixos/tests/gocd-agent.nix b/nixos/tests/gocd-agent.nix index 50470379576b..105b6baa94e2 100644 --- a/nixos/tests/gocd-agent.nix +++ b/nixos/tests/gocd-agent.nix @@ -9,14 +9,14 @@ 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 ]; }; nodes = { - gocd_agent = + agent = { ... }: { virtualisation.memorySize = 2046; @@ -30,11 +30,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" + ) ''; })