Digital Ocean integration test for digital_ocean_tag (#49169)
* Add Digital Ocean integration test template - Actual integration tests will come shortly * Add digital_ocean-tag test * Add integration test for creating and deleting tags * Remove cloud confiugration file * Enhancements for integration test for idempotency - Added new lines per review - Added proper tests for idempotency checks - Actual module is broken so deletion test doesn't work * Add check for do_api_key and instruct if it doesn't work. * Fix indentation * Remove idempotency test for nonidempotency action * Add notes for delete idempotency
This commit is contained in:
parent
4493ba86ec
commit
a55838b013
2 changed files with 53 additions and 0 deletions
2
test/integration/targets/digital_ocean_tag/aliases
Normal file
2
test/integration/targets/digital_ocean_tag/aliases
Normal file
|
@ -0,0 +1,2 @@
|
|||
digital_ocean
|
||||
unsupported
|
51
test/integration/targets/digital_ocean_tag/tasks/main.yml
Normal file
51
test/integration/targets/digital_ocean_tag/tasks/main.yml
Normal file
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
- block:
|
||||
- name: Test API key is provided.
|
||||
fail:
|
||||
msg: do_api_key should be defined in integration_config.yml
|
||||
when: do_api_key is not defined
|
||||
|
||||
- name: Create a new tag
|
||||
digital_ocean_tag:
|
||||
oauth_token: '{{do_api_key}}'
|
||||
name: integration-test
|
||||
state: present
|
||||
register: create_tag
|
||||
|
||||
- name: Create a new tag for idempotency
|
||||
digital_ocean_tag:
|
||||
oauth_token: '{{do_api_key}}'
|
||||
name: integration-test
|
||||
state: present
|
||||
register: create_tag_idempotent
|
||||
|
||||
- debug:
|
||||
var: create_tag
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- create_tag.changed == True
|
||||
- create_tag_idempotent.changed == False
|
||||
- create_tag.data.tag.name == "integration-test"
|
||||
|
||||
always:
|
||||
- name: Delete tag
|
||||
digital_ocean_tag:
|
||||
oauth_token: '{{do_api_key}}'
|
||||
name: integration-test
|
||||
state: absent
|
||||
register: delete_tag
|
||||
|
||||
# FIXME: Deleting a tag isn't idempotent
|
||||
# - name: Delete tag with idempotency
|
||||
# digital_ocean_tag:
|
||||
# oauth_token: '{{do_api_key}}'
|
||||
# name: integration-test
|
||||
# state: absent
|
||||
# register: delete_tag_idempotent
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- delete_tag.changed == True
|
||||
# FIXME: Deleting a tag isn't idempotent
|
||||
# - delete_tag_idempotent.changed == False
|
Loading…
Reference in a new issue