1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/cs_host/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

419 lines
11 KiB
YAML

---
- name: test fail missing params
cs_host:
register: host
ignore_errors: true
- name: verify test fail missing url if host is not existent
assert:
that:
- host is failed
- 'host.msg == "missing required arguments: name"'
- name: test fail missing params if host is not existent
cs_host:
name: sim
register: host
ignore_errors: true
- name: verify test fail missing params if host is not existent
assert:
that:
- host is failed
- 'host.msg == "missing required arguments: password, username, hypervisor, pod"'
- name: test create a host in check mode
cs_host:
name: sim
url: "http://sim/c0-basic/h2"
cluster: C0-basic
pod: POD0-basic
username: root
password: password
hypervisor: Simulator
allocation_state: enabled
host_tags:
- perf
- gpu
register: host
check_mode: true
- name: verify test create a host in check mode
assert:
that:
- host is changed
- name: test create a host
cs_host:
name: sim
url: "http://sim/c0-basic/h2"
cluster: C0-basic
pod: POD0-basic
username: root
password: password
hypervisor: Simulator
allocation_state: enabled
host_tags:
- perf
- gpu
register: host
- name: verify test create a host
assert:
that:
- host is changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- "host.name.startswith('SimulatedAgent.')"
- host.host_tags == ['perf', 'gpu']
# This is special in simulator mode, we can not predict the full hostname.
# That is why we gather the infos from the returns and use a fact.
- name: assume the sim would resolve to the IP address
set_fact:
host_hostname: "{{ host.name }}"
host_ip_address: "{{ host.ip_address }}"
- name: test create a host idempotence
cs_host:
name: "{{ host_hostname }}"
url: "http://sim/c0-basic/h2"
cluster: C0-basic
pod: POD0-basic
username: admin
password: password
hypervisor: Simulator
allocation_state: enabled
host_tags:
- perf
- gpu
register: host
- name: verify test create a host idempotence
assert:
that:
- host is not changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu']
- name: test update host in check mode
cs_host:
name: "{{ host_hostname }}"
url: "http://sim/c0-basic/h2"
cluster: C0-basic
pod: POD0-basic
username: admin
password: password
hypervisor: Simulator
allocation_state: enabled
host_tags:
- perf
- gpu
- x2
register: host
check_mode: true
- name: verify test update a host in check mode
assert:
that:
- host is changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu']
- name: test update host
cs_host:
name: "{{ host_hostname }}"
url: "http://sim/c0-basic/h2"
cluster: C0-basic
pod: POD0-basic
username: admin
password: password
hypervisor: Simulator
allocation_state: enabled
host_tags:
- perf
- gpu
- x2
register: host
- name: verify test update a host in check mode
assert:
that:
- host is changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu', 'x2']
- name: test update host idempotence
cs_host:
name: "{{ host_hostname }}"
url: "http://sim/c0-basic/h2"
cluster: C0-basic
pod: POD0-basic
username: admin
password: password
hypervisor: Simulator
allocation_state: enabled
host_tags:
- perf
- gpu
- x2
register: host
- name: verify test update a host idempotence
assert:
that:
- host is not changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu', 'x2']
# FIXME: Removing by empty list seems to be an issue in the used lib cs underneath, disabled
- name: test update host remove host_tags
cs_host:
name: "{{ host_hostname }}"
url: "http://sim/c0-basic/h2"
cluster: C0-basic
pod: POD0-basic
username: admin
password: password
hypervisor: Simulator
allocation_state: enabled
host_tags: []
register: host
when: false
- name: verify test update host remove host_tags
assert:
that:
- host is changed
- host.host_tags|length == 0
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
when: false
# FIXME: Removing by empty list seems to be an issue in the used lib cs underneath, disabled
- name: test update host remove host_tags idempotence
cs_host:
name: "{{ host_hostname }}"
url: "http://sim/c0-basic/h2"
cluster: C0-basic
pod: POD0-basic
username: admin
password: password
hypervisor: Simulator
allocation_state: enabled
host_tags: []
register: host
when: false
- name: verify test update host remove host_tags idempotence
assert:
that:
- host is not changed
- len(host.host_tags) == 0
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
when: false
- name: test put host in maintenance in check mode
cs_host:
name: "{{ host_hostname }}"
cluster: C0-basic
pod: POD0-basic
allocation_state: maintenance
check_mode: true
register: host
- name: verify test put host in maintenance in check mode
assert:
that:
- host is changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu', 'x2']
- name: test put host in maintenance
cs_host:
name: "{{ host_hostname }}"
cluster: C0-basic
pod: POD0-basic
allocation_state: maintenance
register: host
- name: verify test put host in maintenance
assert:
that:
- host is changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'maintenance'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu', 'x2']
- name: test put host in maintenance idempotence
cs_host:
name: "{{ host_hostname }}"
cluster: C0-basic
pod: POD0-basic
allocation_state: maintenance
register: host
- name: verify test put host in maintenance idempotence
assert:
that:
- host is not changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'maintenance'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu', 'x2']
- name: test put host out of maintenance in check mode
cs_host:
name: "{{ host_hostname }}"
cluster: C0-basic
pod: POD0-basic
allocation_state: enabled
check_mode: true
register: host
- name: verify test put host out of maintenance in check mode
assert:
that:
- host is changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'maintenance'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu', 'x2']
- name: test put host out of maintenance
cs_host:
name: "{{ host_hostname }}"
cluster: C0-basic
pod: POD0-basic
allocation_state: enabled
register: host
- name: verify test put host out of maintenance
assert:
that:
- host is changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu', 'x2']
- name: test put host out of maintenance idempotence
cs_host:
name: "{{ host_hostname }}"
cluster: C0-basic
pod: POD0-basic
allocation_state: enabled
register: host
- name: verify test put host out of maintenance idempotence
assert:
that:
- host is not changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu', 'x2']
- name: test remove host in check mode
cs_host:
name: "{{ host_hostname }}"
cluster: C0-basic
pod: POD0-basic
state: absent
check_mode: true
register: host
- name: verify test remove a host in check mode
assert:
that:
- host is changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu', 'x2']
- name: test remove host
cs_host:
name: "{{ host_hostname }}"
cluster: C0-basic
pod: POD0-basic
state: absent
register: host
- name: verify test remove a host
assert:
that:
- host is changed
- host.cluster == 'C0-basic'
- host.pod == 'POD0-basic'
- host.hypervisor == 'Simulator'
- host.allocation_state == 'enabled'
- host.zone == 'Sandbox-simulator-basic'
- host.state == 'Up'
- host.name == '{{ host_hostname }}'
- host.host_tags == ['perf', 'gpu', 'x2']
- name: test remove host idempotence
cs_host:
name: "{{ host_hostname }}"
cluster: C0-basic
pod: POD0-basic
state: absent
register: host
- name: verify test remove a host idempotenc
assert:
that:
- host is not changed