2015-01-20 21:05:45 +01:00
|
|
|
# ============================================================
|
|
|
|
- name: Test rax_cdb_database with no args
|
|
|
|
rax_cdb_database:
|
|
|
|
ignore_errors: true
|
|
|
|
register: rax_cdb_database
|
|
|
|
|
|
|
|
- name: Validate results of rax_cdb_database with no args
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb_database is failed
|
2015-06-30 16:38:12 +02:00
|
|
|
- 'rax_cdb_database.msg == "missing required arguments: name,cdb_id"'
|
2015-01-20 21:05:45 +01:00
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
- name: Test rax_cdb_database with name
|
|
|
|
rax_cdb_database:
|
|
|
|
name: fail
|
|
|
|
ignore_errors: true
|
|
|
|
register: rax_cdb_database
|
|
|
|
|
|
|
|
- name: Validate results of rax_cdb_database with name
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb_database is failed
|
2015-06-30 16:38:12 +02:00
|
|
|
- 'rax_cdb_database.msg == "missing required arguments: cdb_id"'
|
2015-01-20 21:05:45 +01:00
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
- name: Test rax_cdb_database with name and cdb_id
|
|
|
|
rax_cdb_database:
|
|
|
|
name: fail
|
|
|
|
cdb_id: '1234'
|
|
|
|
ignore_errors: true
|
|
|
|
register: rax_cdb_database
|
|
|
|
|
|
|
|
- name: Validate results of rax_cdb_database with name and cdb_id
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb_database is failed
|
2015-01-20 21:05:45 +01:00
|
|
|
- rax_cdb_database.msg == 'No credentials supplied!'
|
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
- name: Test rax_cdb_database with name, cdb_id and creds
|
|
|
|
rax_cdb_database:
|
|
|
|
username: "{{ rackspace_username }}"
|
|
|
|
api_key: "{{ rackspace_api_key }}"
|
|
|
|
name: fail
|
|
|
|
cdb_id: '1234'
|
|
|
|
ignore_errors: true
|
|
|
|
register: rax_cdb_database
|
|
|
|
|
|
|
|
- name: Validate results of rax_cdb_database with name, cdb_id and creds
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb_database is failed
|
2015-01-20 21:05:45 +01:00
|
|
|
- rax_cdb_database.msg.startswith('None is not a valid region')
|
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
- name: Test rax_cdb_database with name, invalid cdb_id, creds and region
|
|
|
|
rax_cdb_database:
|
|
|
|
username: "{{ rackspace_username }}"
|
|
|
|
api_key: "{{ rackspace_api_key }}"
|
|
|
|
region: "{{ rackspace_region }}"
|
|
|
|
name: fail
|
|
|
|
cdb_id: '1234'
|
|
|
|
ignore_errors: true
|
|
|
|
register: rax_cdb_database
|
|
|
|
|
|
|
|
- name: Validate rax_cdb_database name, invalid cdb_id, creds and region
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb_database is failed
|
2015-01-20 21:05:45 +01:00
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
- name: Build Cloud Database for testing
|
|
|
|
rax_cdb:
|
|
|
|
username: "{{ rackspace_username }}"
|
|
|
|
api_key: "{{ rackspace_api_key }}"
|
|
|
|
region: "{{ rackspace_region }}"
|
|
|
|
name: "{{ resource_prefix }}-rax_cdb_database"
|
|
|
|
wait: true
|
2015-06-29 19:09:16 +02:00
|
|
|
wait_timeout: "{{ rackspace_wait_timeout }}"
|
2015-01-20 21:05:45 +01:00
|
|
|
register: rax_cdb
|
|
|
|
|
|
|
|
- name: Validate build
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb is successful
|
|
|
|
- rax_cdb is changed
|
2015-01-20 21:05:45 +01:00
|
|
|
- rax_cdb.cdb.name == '{{ resource_prefix }}-rax_cdb_database'
|
|
|
|
- rax_cdb.cdb.status == 'ACTIVE'
|
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
- name: Test rax_cdb_database with name, cdb_id, creds and region
|
|
|
|
rax_cdb_database:
|
|
|
|
username: "{{ rackspace_username }}"
|
|
|
|
api_key: "{{ rackspace_api_key }}"
|
|
|
|
region: "{{ rackspace_region }}"
|
|
|
|
name: "{{ resource_prefix }}-1"
|
|
|
|
cdb_id: "{{ rax_cdb.cdb.id }}"
|
|
|
|
register: rax_cdb_database
|
|
|
|
|
|
|
|
- name: Validate rax_cdb_database name, cdb_id, creds and region
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb_database is successful
|
|
|
|
- rax_cdb_database is changed
|
2015-01-20 21:05:45 +01:00
|
|
|
- rax_cdb_database.database.name == "{{ resource_prefix }}-1"
|
|
|
|
|
|
|
|
- name: Delete integration 1
|
|
|
|
rax_cdb_database:
|
|
|
|
username: "{{ rackspace_username }}"
|
|
|
|
api_key: "{{ rackspace_api_key }}"
|
|
|
|
region: "{{ rackspace_region }}"
|
|
|
|
name: "{{ resource_prefix }}-1"
|
|
|
|
cdb_id: "{{ rax_cdb.cdb.id }}"
|
|
|
|
state: absent
|
|
|
|
register: rax_cdb_database
|
|
|
|
|
|
|
|
- name: Validate delete integration 1
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb_database is successful
|
|
|
|
- rax_cdb_database is changed
|
2015-01-20 21:05:45 +01:00
|
|
|
- rax_cdb_database.database.name == "{{ resource_prefix }}-1"
|
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
- name: Test rax_cdb_database idempotency 1
|
|
|
|
rax_cdb_database:
|
|
|
|
username: "{{ rackspace_username }}"
|
|
|
|
api_key: "{{ rackspace_api_key }}"
|
|
|
|
region: "{{ rackspace_region }}"
|
|
|
|
name: "{{ resource_prefix }}-2"
|
|
|
|
cdb_id: "{{ rax_cdb.cdb.id }}"
|
|
|
|
register: rax_cdb_database
|
|
|
|
|
|
|
|
- name: Validate rax_cdb_database idempotency 1
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb_database is successful
|
|
|
|
- rax_cdb_database is changed
|
2015-01-20 21:05:45 +01:00
|
|
|
- rax_cdb_database.database.name == "{{ resource_prefix }}-2"
|
|
|
|
|
|
|
|
- name: Test rax_cdb_database idempotency 2
|
|
|
|
rax_cdb_database:
|
|
|
|
username: "{{ rackspace_username }}"
|
|
|
|
api_key: "{{ rackspace_api_key }}"
|
|
|
|
region: "{{ rackspace_region }}"
|
|
|
|
name: "{{ resource_prefix }}-2"
|
|
|
|
cdb_id: "{{ rax_cdb.cdb.id }}"
|
|
|
|
register: rax_cdb_database
|
|
|
|
|
|
|
|
- name: Validate rax_cdb_database idempotency 2
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb_database is successful
|
|
|
|
- rax_cdb_database is not changed
|
2015-01-20 21:05:45 +01:00
|
|
|
- rax_cdb_database.database.name == "{{ resource_prefix }}-2"
|
|
|
|
|
|
|
|
- name: Delete integration 2
|
|
|
|
rax_cdb_database:
|
|
|
|
username: "{{ rackspace_username }}"
|
|
|
|
api_key: "{{ rackspace_api_key }}"
|
|
|
|
region: "{{ rackspace_region }}"
|
|
|
|
name: "{{ resource_prefix }}-2"
|
|
|
|
cdb_id: "{{ rax_cdb.cdb.id }}"
|
|
|
|
state: absent
|
|
|
|
register: rax_cdb_database
|
|
|
|
|
|
|
|
- name: Validate delete integration 2
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb_database is successful
|
|
|
|
- rax_cdb_database is changed
|
2015-01-20 21:05:45 +01:00
|
|
|
- rax_cdb_database.database.name == "{{ resource_prefix }}-2"
|
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
- name: Delete Cloud Database
|
|
|
|
rax_cdb:
|
|
|
|
username: "{{ rackspace_username }}"
|
|
|
|
api_key: "{{ rackspace_api_key }}"
|
|
|
|
region: "{{ rackspace_region }}"
|
|
|
|
name: "{{ resource_prefix }}-rax_cdb_database"
|
|
|
|
state: absent
|
|
|
|
wait: true
|
2015-06-29 19:09:16 +02:00
|
|
|
wait_timeout: "{{ rackspace_wait_timeout }}"
|
2015-01-20 21:05:45 +01:00
|
|
|
register: rax_cdb
|
|
|
|
|
|
|
|
- name: Validate Delete
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- rax_cdb is successful
|
|
|
|
- rax_cdb is changed
|
2015-01-20 21:05:45 +01:00
|
|
|
- rax_cdb.cdb.name == "{{ resource_prefix }}-rax_cdb_database"
|
|
|
|
# ============================================================
|