diff --git a/changelogs/fragments/289-database-info-integration-test.yml b/changelogs/fragments/289-database-info-integration-test.yml new file mode 100644 index 00000000..d3b55a41 --- /dev/null +++ b/changelogs/fragments/289-database-info-integration-test.yml @@ -0,0 +1,2 @@ +minor_changes: + - integration tests - add a dedicated integration test for C(digital_ocean_database_info) (https://github.com/ansible-collections/community.digitalocean/issues/289). diff --git a/tests/integration/targets/digital_ocean_database_info/aliases b/tests/integration/targets/digital_ocean_database_info/aliases new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/targets/digital_ocean_database_info/defaults/main.yml b/tests/integration/targets/digital_ocean_database_info/defaults/main.yml new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/targets/digital_ocean_database_info/tasks/main.yml b/tests/integration/targets/digital_ocean_database_info/tasks/main.yml new file mode 100644 index 00000000..e526cef1 --- /dev/null +++ b/tests/integration/targets/digital_ocean_database_info/tasks/main.yml @@ -0,0 +1,20 @@ +--- +- block: + + - name: Ensure API key is provided + ansible.builtin.fail: + msg: do_api_key should be defined in tests/integration/integration_config.yml + when: + - do_api_key is not defined + - do_api_key | length == 0 + + - name: Fetch all databases + community.digitalocean.digital_ocean_database_info: + oauth_token: "{{ do_api_key }}" + register: result + + - name: Ensure all databases found + ansible.builtin.assert: + that: + - not result.changed + - result.data is defined