mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
7bdbe9ab87
* vultr: new module vr_startup_script * add integration tests
141 lines
4.1 KiB
YAML
141 lines
4.1 KiB
YAML
---
|
|
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
- name: setup
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
state: absent
|
|
register: result
|
|
- name: verify setup
|
|
assert:
|
|
that:
|
|
- result is success
|
|
|
|
- name: test fail if missing name
|
|
vr_startup_script:
|
|
register: result
|
|
ignore_errors: yes
|
|
- name: verify test fail if missing name
|
|
assert:
|
|
that:
|
|
- result is failed
|
|
- 'result.msg == "missing required arguments: name"'
|
|
|
|
- name: test fail if missing params for state=present
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
register: result
|
|
ignore_errors: yes
|
|
- name: verify fail if missing params for state=present
|
|
assert:
|
|
that:
|
|
- result is failed
|
|
- 'result.msg == "state is present but all of the following are missing: script"'
|
|
|
|
- name: test create startup script in check mode
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
script: "{{ vr_startup_script }}"
|
|
register: result
|
|
check_mode: yes
|
|
- name: verify test create startup script in check mode
|
|
assert:
|
|
that:
|
|
- result is changed
|
|
|
|
- name: test create startup script
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
script: "{{ vr_startup_script }}"
|
|
register: result
|
|
- name: verify test create startup script
|
|
assert:
|
|
that:
|
|
- result is changed
|
|
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
|
- result.vultr_startup_script.script == '{{ vr_startup_script }}'
|
|
|
|
- name: test create startup script idempotence
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
script: "{{ vr_startup_script }}"
|
|
register: result
|
|
- name: verify test create startup script idempotence
|
|
assert:
|
|
that:
|
|
- result is not changed
|
|
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
|
- result.vultr_startup_script.script == '{{ vr_startup_script }}'
|
|
|
|
- name: test update startup script in check mode
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
script: "{{ vr_startup_script2 }}"
|
|
register: result
|
|
check_mode: yes
|
|
- name: verify test update startup script in check mode
|
|
assert:
|
|
that:
|
|
- result is changed
|
|
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
|
- result.vultr_startup_script.script == '{{ vr_startup_script }}'
|
|
|
|
- name: test update startup script
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
script: "{{ vr_startup_script2 }}"
|
|
register: result
|
|
- name: verify test update startup script
|
|
assert:
|
|
that:
|
|
- result is changed
|
|
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
|
- result.vultr_startup_script.script == '{{ vr_startup_script2 }}'
|
|
|
|
- name: test update startup script idempotence
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
script: "{{ vr_startup_script2 }}"
|
|
register: result
|
|
- name: verify test update startup script idempotence
|
|
assert:
|
|
that:
|
|
- result is not changed
|
|
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
|
- result.vultr_startup_script.script == '{{ vr_startup_script2 }}'
|
|
|
|
- name: test absent startup script in check mode
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
state: absent
|
|
register: result
|
|
check_mode: yes
|
|
- name: verify test absent startup script in check mode
|
|
assert:
|
|
that:
|
|
- result is changed
|
|
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
|
- result.vultr_startup_script.script == '{{ vr_startup_script2 }}'
|
|
|
|
- name: test absent startup script
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
state: absent
|
|
register: result
|
|
- name: verify test absent startup script
|
|
assert:
|
|
that:
|
|
- result is changed
|
|
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
|
- result.vultr_startup_script.script == '{{ vr_startup_script2 }}'
|
|
|
|
- name: test absent startup script idempotence
|
|
vr_startup_script:
|
|
name: "{{ vr_startup_script_name }}"
|
|
state: absent
|
|
register: result
|
|
- name: verify test absent startup script idempotence
|
|
assert:
|
|
that:
|
|
- result is not changed
|