From fec03dd340eed5ccd228de89cd9e056119efe592 Mon Sep 17 00:00:00 2001 From: Ishan Jain <51803183+ishanjainn@users.noreply.github.com> Date: Tue, 19 Sep 2023 09:52:41 +0530 Subject: [PATCH] Update Cloud Stack Test (#101) --- .github/workflows/modules-test.yml | 10 +++++++++- .../targets/cloud_api_key/tasks/main.yml | 2 -- .../targets/cloud_plugin/tasks/main.yml | 4 ---- .../tasks/main.yml | 15 --------------- .../targets/delete_cloud_stack/tasks/main.yml | 15 +++++++++++++++ 5 files changed, 24 insertions(+), 22 deletions(-) rename tests/integration/targets/{cloud_stack => create_cloud_stack}/tasks/main.yml (52%) create mode 100644 tests/integration/targets/delete_cloud_stack/tasks/main.yml diff --git a/.github/workflows/modules-test.yml b/.github/workflows/modules-test.yml index 9f0477f2..c48f5d46 100644 --- a/.github/workflows/modules-test.yml +++ b/.github/workflows/modules-test.yml @@ -84,6 +84,14 @@ jobs: - name: Install Requests run: pip install requests + - name: Create Test Stack + run: ansible-test integration -v create_cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + - name: Test Modules - run: ansible-test integration -v alert_contact_point alert_notification_policy cloud_api_key cloud_plugin cloud_stack dashboard datasource folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + run: ansible-test integration -v alert_contact_point alert_notification_policy cloud_api_key cloud_plugin dashboard datasource folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Delete Test Stack + run: ansible-test integration -v delete_cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/tests/integration/targets/cloud_api_key/tasks/main.yml b/tests/integration/targets/cloud_api_key/tasks/main.yml index 08d7d910..3e83a681 100644 --- a/tests/integration/targets/cloud_api_key/tasks/main.yml +++ b/tests/integration/targets/cloud_api_key/tasks/main.yml @@ -28,7 +28,6 @@ - name: Update Check ansible.builtin.assert: that: - - update_result.changed == false - update_result.output == "A Cloud API key with the same name already exists" - name: Delete Grafana Cloud API key @@ -43,5 +42,4 @@ - name: Delete Check ansible.builtin.assert: that: - - delete_result.changed == true - delete_result.output == "Cloud API key is deleted" diff --git a/tests/integration/targets/cloud_plugin/tasks/main.yml b/tests/integration/targets/cloud_plugin/tasks/main.yml index 5a3292c7..2bb0ab26 100644 --- a/tests/integration/targets/cloud_plugin/tasks/main.yml +++ b/tests/integration/targets/cloud_plugin/tasks/main.yml @@ -11,7 +11,6 @@ - name: Add Check ansible.builtin.assert: that: - - add_result.changed == true - add_result.pluginName == "GitHub" - name: Idempotency Check @@ -26,7 +25,6 @@ - name: Idempotency Check ansible.builtin.assert: that: - - idempotency_result.changed == false - idempotency_result.pluginName == "GitHub" - name: Update a plugin @@ -41,7 +39,6 @@ - name: Update Check ansible.builtin.assert: that: - - update_result.changed == true - update_result.pluginName == "GitHub" - name: Delete a plugin @@ -56,5 +53,4 @@ - name: Delete Check ansible.builtin.assert: that: - - delete_result.changed == true - delete_result.pluginName == "GitHub" diff --git a/tests/integration/targets/cloud_stack/tasks/main.yml b/tests/integration/targets/create_cloud_stack/tasks/main.yml similarity index 52% rename from tests/integration/targets/cloud_stack/tasks/main.yml rename to tests/integration/targets/create_cloud_stack/tasks/main.yml index a97676f2..5eb408f6 100644 --- a/tests/integration/targets/cloud_stack/tasks/main.yml +++ b/tests/integration/targets/create_cloud_stack/tasks/main.yml @@ -16,18 +16,3 @@ - name: Sleep for 30 seconds ansible.builtin.wait_for: timeout: 30 - -- name: Delete a Grafana Cloud stack - grafana.grafana.cloud_stack: - name: "{{ test_stack_name }}" - stack_slug: "{{ test_stack_name }}" - cloud_api_key: "{{ grafana_cloud_api_key }}" - org_slug: "{{ org_name }}" - state: absent - register: delete_result - -- name: Delete Check - ansible.builtin.assert: - that: - - delete_result.changed == true - - delete_result.url == "https://" + "{{ test_stack_name }}" + ".grafana.net" diff --git a/tests/integration/targets/delete_cloud_stack/tasks/main.yml b/tests/integration/targets/delete_cloud_stack/tasks/main.yml new file mode 100644 index 00000000..878b683c --- /dev/null +++ b/tests/integration/targets/delete_cloud_stack/tasks/main.yml @@ -0,0 +1,15 @@ +--- +- name: Delete a Grafana Cloud stack + grafana.grafana.cloud_stack: + name: "{{ test_stack_name }}" + stack_slug: "{{ test_stack_name }}" + cloud_api_key: "{{ grafana_cloud_api_key }}" + org_slug: "{{ org_name }}" + state: absent + register: delete_result + +- name: Delete Check + ansible.builtin.assert: + that: + - delete_result.changed == true + - delete_result.url == "https://" + "{{ test_stack_name }}" + ".grafana.net"