From 1c91b9bb897a2bdf35d7e6e225512d53fb7edbae Mon Sep 17 00:00:00 2001 From: ginger Date: Jun 01 2021 12:41:49 +0000 Subject: add role: testing-farm-run-test --- diff --git a/roles/testing-farm-run-test/tasks/main.yml b/roles/testing-farm-run-test/tasks/main.yml new file mode 100644 index 0000000..079ee68 --- /dev/null +++ b/roles/testing-farm-run-test/tasks/main.yml @@ -0,0 +1,51 @@ +--- +# tasks file for testing-farm-run-test +tasks: + - name: trigger a Testing Farm test + uri: + url: "{{ api_url }}/requests" + method: POST + body_format: json + body: + api_key: "{{ api_key }}" + test: "{{ test }}" + environments: "{{ environments }}" + status_code: 200, 201 + timeout: 30 + register: id + + - name: wait until the state is complete or error + uri: + url: "{{ api_url }}/requests/{{ id.json.id }}" + method: GET + body_format: json + body: + api_key: "{{ api_key }}" + status_code: 200 + timeout: 30 + register: response + until: response.json.state == "complete" or + response.json.state == "error" + retries: 720 + delay: 60 + ignore_errors: true + + - name: Testing Farm API request response + debug: var=response + + - name: Testing Farm artifacts + debug: msg="See https://artifacts.dev.testing-farm.io/{{ id.json.id }} for detailed results" + + - name: Check the result for timeout + fail: msg="Testing has timed out in 12 hours" + when: response.json.result.overall is undefined or response.json.state == "running" or response.json.state == "queued" + + - name: Check the result for error + fail: msg="Testing Farm failed to finish the test process" + when: response.json.state == "error" + + - name: Check the result for failure + fail: msg="Tests have failed" + when: response.json.result.overall == "failed" + + - debug: msg="Tests have passed"