Skip to content

Commit

Permalink
add instance group
Browse files Browse the repository at this point in the history
  • Loading branch information
resmo committed Nov 27, 2024
1 parent 065c1f7 commit 57aaa35
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/integration/targets/instance/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cloud/cs
cs/group1
cs/group3
cs/group4
3 changes: 3 additions & 0 deletions tests/integration/targets/instance_group/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cloud/cs
cs/group1
cs/group4
3 changes: 3 additions & 0 deletions tests/integration/targets/instance_group/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- cs_common
79 changes: 79 additions & 0 deletions tests/integration/targets/instance_group/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
- name: setup
ngine_io.cloudstack.instance_group:
name: "{{ cs_resource_prefix }}_ig"
state: absent

- name: test fail if missing name
ngine_io.cloudstack.instance_group:
register: ig
ignore_errors: true
- name: verify results of fail if missing name
assert:
that:
- ig is failed
- "ig.msg == 'missing required arguments: name'"

- name: test present instance group in check mode
ngine_io.cloudstack.instance_group:
name: "{{ cs_resource_prefix }}_ig"
register: ig
check_mode: true
- name: verify results of create instance group in check mode
assert:
that:
- ig is changed

- name: test present instance group
ngine_io.cloudstack.instance_group:
name: "{{ cs_resource_prefix }}_ig"
register: ig
- name: verify results of create instance group
assert:
that:
- ig is changed
- ig.name == cs_resource_prefix + "_ig"

- name: test present instance group is idempotence
ngine_io.cloudstack.instance_group:
name: "{{ cs_resource_prefix }}_ig"
register: ig
- name: verify results present instance group is idempotence
assert:
that:
- ig is not changed
- ig.name == cs_resource_prefix + "_ig"

- name: test absent instance group in check mode
ngine_io.cloudstack.instance_group:
name: "{{ cs_resource_prefix }}_ig"
state: absent
register: ig
check_mode: true
- name: verify results of absent instance group in check mode
assert:
that:
- ig is changed
- ig.name == cs_resource_prefix + "_ig"

- name: test absent instance group
ngine_io.cloudstack.instance_group:
name: "{{ cs_resource_prefix }}_ig"
state: absent
register: ig
- name: verify results of absent instance group
assert:
that:
- ig is changed
- ig.name == cs_resource_prefix + "_ig"

- name: test absent instance group is idempotence
ngine_io.cloudstack.instance_group:
name: "{{ cs_resource_prefix }}_ig"
state: absent
register: ig
- name: verify results of absent instance group is idempotence
assert:
that:
- ig is not changed
- ig.name is undefined

0 comments on commit 57aaa35

Please sign in to comment.