summaryrefslogtreecommitdiff
path: root/test/integration/roles/test_cs_cluster/tasks/main.yml
blob: bfaa09805d5dd90895a9e3e7a4d80b113b43fc98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
---
- name: setup cluster is absent
  cs_cluster:
    name: "{{ cs_resource_prefix }}-cluster"
    state: absent
  register: cluster
- name: verify setup cluster is absent
  assert:
    that:
      - cluster|success

- name: setup zone is present
  cs_zone:
    name: "{{ cs_resource_prefix }}-zone"
    dns1: 8.8.8.8
    dns2: 8.8.4.4
    network_type: basic
  register: zone
- name: verify setup zone is present
  assert:
    that:
      - zone|success

- name: setup pod is preset
  cs_pod:
    name: "{{ cs_resource_prefix }}-pod"
    zone: "{{ cs_resource_prefix }}-zone"
    start_ip: 10.100.10.101
    gateway: 10.100.10.1
    netmask: 255.255.255.0
  register: pod
- name: verify setup pod is preset
  assert:
    that:
      - pod|success

- name: test fail if missing name
  cs_cluster:
  register: cluster
  ignore_errors: true
- name: verify results of fail if missing name
  assert:
    that:
      - cluster|failed
      - "cluster.msg == 'missing required arguments: name'"

- name: test create cluster
  cs_cluster:
    name: "{{ cs_resource_prefix }}-cluster"
    zone: "{{ cs_resource_prefix }}-zone"
    hypervisor: simulator
    cluster_type: CloudManaged
  register: cluster_origin
  tags: disable
- name: verify test create cluster
  assert:
    that:
      - cluster_origin|changed
      - cluster_origin.name == "{{ cs_resource_prefix }}-cluster"
      - cluster_origin.zone == "{{ cs_resource_prefix }}-zone"
      - cluster_origin.allocation_state == "Enabled"
      - cluster_origin.hypervisor == "Simulator"
      - cluster_origin.cluster_type == "CloudManaged"

- name: test create cluster idempotence
  cs_cluster:
    name: "{{ cs_resource_prefix }}-Cluster"
    zone: "{{ cs_resource_prefix }}-Zone"
    hypervisor: Simulator
    cluster_type: CloudManaged
  register: cluster
- name: verify test create cluster idempotence
  assert:
    that:
      - cluster.id == cluster_origin.id
      - not cluster|changed
      - cluster.name == "{{ cs_resource_prefix }}-cluster"
      - cluster.zone == "{{ cs_resource_prefix }}-zone"
      - cluster.allocation_state == "Enabled"
      - cluster_origin.hypervisor == "Simulator"
      - cluster.cluster_type == "CloudManaged"

- name: test update cluster
  cs_cluster:
    name: "{{ cs_resource_prefix }}-cluster"
    zone: "{{ cs_resource_prefix }}-zone"
    hypervisor: simulator
    cluster_type: ExternalManaged
  register: cluster
- name: verify test update cluster
  assert:
    that:
      - cluster|changed
      - cluster.name == "{{ cs_resource_prefix }}-cluster"
      - cluster.zone == "{{ cs_resource_prefix }}-zone"
      - cluster.allocation_state == "Enabled"
      - cluster.hypervisor == "Simulator"
      - cluster.cluster_type == "ExternalManaged"
      - cluster.id == cluster_origin.id

- name: test update cluster idempotence
  cs_cluster:
    name: "{{ cs_resource_prefix }}-cluster"
    zone: "{{ cs_resource_prefix }}-zone"
    hypervisor: simulator
    cluster_type: ExternalManaged
  register: cluster
- name: verify test update cluster idempotence
  assert:
    that:
      - not cluster|changed
      - cluster.name == "{{ cs_resource_prefix }}-cluster"
      - cluster.zone == "{{ cs_resource_prefix }}-zone"
      - cluster.allocation_state == "Enabled"
      - cluster.hypervisor == "Simulator"
      - cluster.cluster_type == "ExternalManaged"
      - cluster.id == cluster_origin.id

- name: test disable cluster
  cs_cluster:
    name: "{{ cs_resource_prefix }}-cluster"
    state: disabled
  register: cluster
  tags: disable
- name: verify test disable cluster
  assert:
    that:
      - cluster|changed
      - cluster.name == "{{ cs_resource_prefix }}-cluster"
      - cluster.zone == "{{ cs_resource_prefix }}-zone"
      - cluster.allocation_state == "Disabled"
      - cluster.hypervisor == "Simulator"
      - cluster.cluster_type == "ExternalManaged"
      - cluster.id == cluster_origin.id
  tags: disable

- name: test disable cluster idempotence
  cs_cluster:
    name: "{{ cs_resource_prefix }}-cluster"
    state: disabled
  register: cluster
  tags: disable
- name: verify test disable cluster idempotence
  assert:
    that:
      - not cluster|changed
      - cluster.name == "{{ cs_resource_prefix }}-cluster"
      - cluster.zone == "{{ cs_resource_prefix }}-zone"
      - cluster.allocation_state == "Disabled"
      - cluster.hypervisor == "Simulator"
      - cluster.cluster_type == "ExternalManaged"
  tags: disable

- name: test enable cluster
  cs_cluster:
    name: "{{ cs_resource_prefix }}-cluster"
    state: enabled
  register: cluster
- name: verify test enable cluster
  assert:
    that:
      - cluster|changed
      - cluster.name == "{{ cs_resource_prefix }}-cluster"
      - cluster.zone == "{{ cs_resource_prefix }}-zone"
      - cluster.allocation_state == "Enabled"
      - cluster.hypervisor == "Simulator"
      - cluster.cluster_type == "ExternalManaged"
      - cluster.id == cluster_origin.id

- name: test enable cluster idempotence
  cs_cluster:
    name: "{{ cs_resource_prefix }}-cluster"
    state: enabled
  register: cluster
- name: verify test enable cluster idempotence
  assert:
    that:
      - not cluster|changed
      - cluster.name == "{{ cs_resource_prefix }}-cluster"
      - cluster.zone == "{{ cs_resource_prefix }}-zone"
      - cluster.allocation_state == "Enabled"
      - cluster.hypervisor == "Simulator"
      - cluster.cluster_type == "ExternalManaged"
      - cluster.id == cluster_origin.id

- name: test remove cluster
  cs_cluster:
    name: "{{ cs_resource_prefix }}-cluster"
    zone: "{{ cs_resource_prefix }}-zone"
    state: absent
  register: cluster
- name: verify test remove cluster
  assert:
    that:
      - cluster.id == cluster_origin.id
      - cluster|changed
      - cluster.name == "{{ cs_resource_prefix }}-cluster"
      - cluster.zone == "{{ cs_resource_prefix }}-zone"
      - cluster.allocation_state == "Enabled"
      - cluster_origin.hypervisor == "Simulator"

- name: test remove cluster idempotence
  cs_cluster:
    name: "{{ cs_resource_prefix }}-cluster"
    zone: "{{ cs_resource_prefix }}-zone"
    state: absent
  register: cluster
- name: verify test remove cluster idempotence
  assert:
    that:
      - not cluster|changed