···
services.openssh.enable = true;
···
client.succeed("git -C /tmp/repo push origin main")
def poll_workflow_action_status(_) -> bool:
256
-
output = server.succeed(
257
-
"curl --fail http://localhost:3000/test/repo/actions | "
258
-
+ 'htmlq ".flex-item-leading span" --attribute "data-tooltip-content"'
256
+
response = server.succeed("curl --fail http://localhost:3000/api/v1/repos/test/repo/actions/tasks")
257
+
status = json.loads(response).get("workflow_runs")[0].get("status")
261
-
# values taken from https://codeberg.org/forgejo/forgejo/src/commit/af47c583b4fb3190fa4c4c414500f9941cc02389/options/locale/locale_en-US.ini#L3649-L3661
262
-
if output in [ "Failure", "Canceled", "Skipped", "Blocked" ]:
263
-
raise Exception(f"Workflow status is '{output}', which we consider failed.")
264
-
server.log(f"Command returned '{output}', which we consider failed.")
266
-
elif output in [ "Unknown", "Waiting", "Running", "" ]:
267
-
server.log(f"Workflow status is '{output}'. Waiting some more...")
262
+
server.log(f"Workflow status: {status}")
270
-
elif output in [ "Success" ]:
264
+
if status == "failure":
265
+
raise Exception("Workflow failed")
273
-
raise Exception(f"Workflow status is '{output}', which we don't know. Value mappings likely need updating.")
267
+
return status == "success"
with server.nested("Waiting for the workflow run to be successful"):
276
-
retry(poll_workflow_action_status)
270
+
retry(poll_workflow_action_status, 60)
with subtest("Testing backup service"):
server.succeed("${serverSystem}/specialisation/dump/bin/switch-to-configuration test")