summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/cs_instance/tasks/absent.yml
blob: 0ecb134219919b0e389089a8fa03a75f6133e28a (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
---
- name: test destroy instance in check mode
  cs_instance:
    name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
    state: absent
  register: instance
  check_mode: true
- name: verify destroy instance in check mode
  assert:
    that:
    - instance is successful
    - instance is changed
    - instance.state != "Destroyed"

- name: test destroy instance
  cs_instance:
    name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
    state: absent
  register: instance
- name: verify destroy instance
  assert:
    that:
    - instance is successful
    - instance is changed
    - instance.state == "Destroyed"

- name: test destroy instance idempotence
  cs_instance:
    name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
    state: absent
  register: instance
- name: verify destroy instance idempotence
  assert:
    that:
    - instance is successful
    - instance is not changed

- name: test recover to stopped state and update a deleted instance in check mode
  cs_instance:
    name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
    service_offering: "{{ test_cs_instance_offering_1 }}"
    state: stopped
  register: instance
  check_mode: true
- name: verify test recover to stopped state and update a deleted instance in check mode
  assert:
    that:
    - instance is successful
    - instance is changed

- name: test recover to stopped state and update a deleted instance
  cs_instance:
    name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
    service_offering: "{{ test_cs_instance_offering_1 }}"
    state: stopped
  register: instance
- name: verify test recover to stopped state and update a deleted instance
  assert:
    that:
    - instance is successful
    - instance is changed
    - instance.state == "Stopped"
    - instance.service_offering == "{{ test_cs_instance_offering_1 }}"

- name: test recover to stopped state and update a deleted instance idempotence
  cs_instance:
    name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
    service_offering: "{{ test_cs_instance_offering_1 }}"
    state: stopped
  register: instance
- name: verify test recover to stopped state and update a deleted instance idempotence
  assert:
    that:
    - instance is successful
    - instance is not changed
    - instance.state == "Stopped"
    - instance.service_offering == "{{ test_cs_instance_offering_1 }}"

- name: test expunge instance in check mode
  cs_instance:
    name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
    state: expunged
  register: instance
  check_mode: true
- name: verify test expunge instance in check mode
  assert:
    that:
    - instance is successful
    - instance is changed
    - instance.state == "Stopped"
    - instance.service_offering == "{{ test_cs_instance_offering_1 }}"

- name: test expunge instance
  cs_instance:
    name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
    state: expunged
  register: instance
- name: verify test expunge instance
  assert:
    that:
    - instance is successful
    - instance is changed
    - instance.state == "Stopped"
    - instance.service_offering == "{{ test_cs_instance_offering_1 }}"

- name: test expunge instance idempotence
  cs_instance:
    name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
    state: expunged
  register: instance
- name: verify test expunge instance idempotence
  assert:
    that:
    - instance is successful
    - instance is not changed