ansible/test/integration/targets/cs_domain/tasks/main.yml
Matt Martz 4fe08441be Deprecate tests used as filters (#32361)
* Warn on tests used as filters

* Update docs, add aliases for tests that fit more gramatically with test syntax

* Fix rst formatting

* Add successful filter, alias of success

* Remove renamed_deprecation, it was overkill

* Make directory alias for is_dir

* Update tests to use proper jinja test syntax

* Update additional documentation, living outside of YAML files, to reflect proper jinja test syntax

* Add conversion script, porting guide updates, and changelog updates

* Update newly added uses of tests as filters

* No underscore variable

* Convert recent tests as filter changes to win_stat

* Fix some changes related to rebasing a few integration tests

* Make tests_as_filters_warning explicitly accept the name of the test, instead of inferring the name

* Add test for tests_as_filters_warning

* Update tests as filters in newly added/modified tests

* Address recent changes to several integration tests

* Address recent changes in cs_vpc
2017-11-27 17:58:08 -05:00

241 lines
7.2 KiB
YAML

---
- name: setup
cs_domain:
path: "{{ cs_resource_prefix }}_domain"
state: absent
register: dom
- name: verify setup
assert:
that:
- dom is successful
- name: test fail if missing name
action: cs_domain
register: dom
ignore_errors: true
- name: verify results of fail if missing params
assert:
that:
- dom is failed
- 'dom.msg == "missing required arguments: path"'
- name: test fail if ends with /
cs_domain:
path: "{{ cs_resource_prefix }}_domain/"
register: dom
ignore_errors: true
- name: verify results of fail if ends with /
assert:
that:
- dom is failed
- dom.msg == "Path '{{ cs_resource_prefix }}_domain/' must not end with /"
- name: test create a domain in check mode
cs_domain:
path: "{{ cs_resource_prefix }}_domain"
register: dom
check_mode: true
- name: verify results of test create a domain in check mode
assert:
that:
- dom is changed
- name: test create a domain
cs_domain:
path: "{{ cs_resource_prefix }}_domain"
register: dom
- name: verify results of test create a domain
assert:
that:
- dom is changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain"
- dom.name == "{{ cs_resource_prefix }}_domain"
- name: test create a domain idempotence
cs_domain:
path: "{{ cs_resource_prefix }}_domain"
register: dom
- name: verify results of test create a domain idempotence
assert:
that:
- dom is not changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain"
- dom.name == "{{ cs_resource_prefix }}_domain"
- name: test create a domain idempotence2
cs_domain:
path: "/{{ cs_resource_prefix }}_domain"
register: dom
- name: verify results of test create a domain idempotence2
assert:
that:
- dom is not changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain"
- dom.name == "{{ cs_resource_prefix }}_domain"
- name: test fail to create a subdomain for inexistent domain
cs_domain:
path: ROOT/inexistent/{{ cs_resource_prefix }}_subdomain
register: dom
ignore_errors: true
- name: test fail to create a subdomain for inexistent domain
assert:
that:
- dom is failed
- dom.msg == "Parent domain path ROOT/inexistent does not exist"
- name: test create a subdomain in check mode
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
register: dom
check_mode: true
- name: verify results of test create a domain in check mode
assert:
that:
- dom is changed
- name: test create a subdomain
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
register: dom
- name: verify results of test create a domain
assert:
that:
- dom is changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test create a subdomain idempotence
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
register: dom
- name: verify results of test create a subdomain idempotence
assert:
that:
- dom is not changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test update a subdomain in check mode
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
network_domain: domain.example.com
register: dom
check_mode: true
- name: verify results of test update a subdomain in check mode
assert:
that:
- dom is changed
- dom.network_domain is undefined
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test update a subdomain
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
network_domain: domain.example.com
register: dom
- name: verify results of test update a subdomain
assert:
that:
- dom is changed
- dom.network_domain == "domain.example.com"
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test update a subdomain idempotence
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
network_domain: domain.example.com
register: dom
- name: verify results of test update a subdomain idempotence
assert:
that:
- dom is not changed
- dom.network_domain == "domain.example.com"
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test delete a subdomain in check mode
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
state: absent
register: dom
check_mode: true
- name: verify results of test delete a subdomain in check mode
assert:
that:
- dom is changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test delete a subdomain
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
state: absent
register: dom
- name: verify results of test delete a subdomain
assert:
that:
- dom is changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test delete a subdomain idempotence
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
state: absent
register: dom
- name: verify results of test delete a subdomain idempotence
assert:
that:
- dom is not changed
- name: test create a subdomain 2
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
register: dom
- name: verify results of test create a subdomain 2
assert:
that:
- dom is changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test delete a domain with clean up in check mode
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain
state: absent
clean_up: true
register: dom
check_mode: true
- name: verify results of test delete a domain with clean up in check mode
assert:
that:
- dom is changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain"
- dom.name == "{{ cs_resource_prefix }}_domain"
- name: test delete a domain with clean up
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain
state: absent
clean_up: true
register: dom
- name: verify results of test delete a domain with clean up
assert:
that:
- dom is changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain"
- dom.name == "{{ cs_resource_prefix }}_domain"
- name: test delete a domain with clean up idempotence
cs_domain:
path: ROOT/{{ cs_resource_prefix }}_domain
state: absent
clean_up: true
register: dom
- name: verify results of test delete a domain with clean up idempotence
assert:
that:
- dom is not changed