[GCE] updates to gce integration test (#18097)
* Added test for sequenced-name instance generation (num_instances) * Added param-check tags to tests that only do argument checking Should be merged AFTER ansible/ansible-modules-core#4276
This commit is contained in:
parent
3fd03b764b
commit
b9e07c8dd7
1 changed files with 43 additions and 2 deletions
|
@ -5,12 +5,14 @@
|
|||
gce:
|
||||
register: result
|
||||
ignore_errors: true
|
||||
tags:
|
||||
- param-check
|
||||
|
||||
- name: assert failure when called with no parameters
|
||||
assert:
|
||||
that:
|
||||
- 'result.failed'
|
||||
- 'result.msg == "Missing GCE connection parameters in libcloud secrets file."'
|
||||
- 'result.msg == "Must specify a \"name\" or \"instance_names\""'
|
||||
|
||||
# ============================================================
|
||||
- name: test missing name
|
||||
|
@ -20,8 +22,10 @@
|
|||
project_id: "{{ project_id }}"
|
||||
register: result
|
||||
ignore_errors: true
|
||||
tags:
|
||||
- param-check
|
||||
|
||||
- name: assert failure when called with no parameters
|
||||
- name: assert failure when missing name
|
||||
assert:
|
||||
that:
|
||||
- 'result.failed'
|
||||
|
@ -95,6 +99,43 @@
|
|||
- 'result.name == "{{ instance_name }}"'
|
||||
- 'result.state == "absent"'
|
||||
|
||||
# ============================================================
|
||||
- name: test num_instances state=present (expected changed=true)
|
||||
gce:
|
||||
base_name: "{{ instance_name }}"
|
||||
num_instances: 2
|
||||
service_account_email: "{{ service_account_email }}"
|
||||
pem_file: "{{ pem_file }}"
|
||||
project_id: "{{ project_id }}"
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- name: assert state=present (expected changed=true)
|
||||
assert:
|
||||
that:
|
||||
- 'result.changed'
|
||||
- 'result.name == "{{ instance_name }}"'
|
||||
- 'result.state == "present"'
|
||||
- 'result.instance_data|length == 2'
|
||||
|
||||
# ============================================================
|
||||
- name: test num_instances state=absent (expected changed=true)
|
||||
gce:
|
||||
base_name: "{{ instance_name }}"
|
||||
num_instances: 2
|
||||
service_account_email: "{{ service_account_email }}"
|
||||
pem_file: "{{ pem_file }}"
|
||||
project_id: "{{ project_id }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: assert num_instances state=absent (expected changed=true)
|
||||
assert:
|
||||
that:
|
||||
- 'result.changed'
|
||||
- 'result.state == "absent"'
|
||||
- 'result.instance_names == ["{{ instance_name }}-000", "{{ instance_name }}-001"]'
|
||||
|
||||
# ============================================================
|
||||
- name: test disks given (expected changed=true)
|
||||
gce:
|
||||
|
|
Loading…
Reference in a new issue