forked from linux-system-roles/storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests_lvm_errors.yml
More file actions
224 lines (209 loc) · 7.27 KB
/
tests_lvm_errors.yml
File metadata and controls
224 lines (209 loc) · 7.27 KB
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
212
213
214
215
216
217
218
219
220
221
222
223
224
---
- name: Test lvm errors
hosts: all
become: true
vars:
mount_location1: '/opt/test1'
mount_location2: '/opt/test2'
volume_group_size: '10g'
volume1_size: '5g'
volume2_size: '2g'
invalid_disks:
- '/non/existent/disk'
invalid_size: 'xyz GiB'
unused_disk_subfact: '{{ ansible_devices[unused_disks[0]] }}'
tags:
- tests::lvm
tasks:
- name: Run the role
include_role:
name: linux-system-roles.storage
- name: Mark tasks to be skipped
set_fact:
storage_skip_checks:
- blivet_available
- "{{ (lookup('env',
'SYSTEM_ROLES_REMOVE_CLOUD_INIT') in ['', 'false']) |
ternary('packages_installed', '') }}"
- service_facts
- name: Get unused disks
include_tasks: get_unused_disk.yml
vars:
min_size: "{{ volume_group_size }}"
max_return: 1
- name: Test for correct handling of invalid disk specifications.
include_tasks: verify-role-failed.yml
vars:
__storage_failed_regex: unable to resolve any disks specified for pool
__storage_failed_msg: Role did not report error about invalid disks
__storage_failed_params:
storage_pools:
- name: foo
disks: "{{ invalid_disks }}"
volumes:
- name: test1
size: "{{ volume1_size }}"
mount_point: "{{ mount_location1 }}"
- name: Test for correct handling of invalid size specification.
include_tasks: verify-role-failed.yml
vars:
__storage_failed_regex: invalid size specification
__storage_failed_msg: Role did not report that the size spec is invalid
__storage_failed_params:
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
volumes:
- name: test1
size: "{{ invalid_size }}"
mount_point: "{{ mount_location1 }}"
- name: Test for correct handling of missing disk specification.
include_tasks: verify-role-failed.yml
vars:
__storage_failed_regex: no disks specified for pool
__storage_failed_msg: Role did not report that no disks were specified
__storage_failed_params:
storage_pools:
- name: foo
disks: []
volumes:
- name: test1
size: "{{ volume1_size }}"
mount_point: "{{ mount_location1 }}"
- name: Test for correct handling of LVM volume not defined within a pool.
include_tasks: verify-role-failed.yml
vars:
__storage_failed_exception: >-
NoneType.* object has no attribute .*_device.*
__storage_failed_params:
storage_volumes:
- name: test1
type: lvm
disks: []
size: "{{ volume1_size }}"
mount_point: "{{ mount_location1 }}"
- name: Test for correct handling of duplicate pool names
include_tasks: verify-role-failed.yml
vars:
__storage_failed_regex: multiple pools with the same name
__storage_failed_msg: >-
Unexpected behavior w/ multiple pools sharing one name
__storage_failed_params:
storage_pools:
- name: pool1
type: lvm
disks: "{{ unused_disks }}"
- name: pool1
type: lvm
disks: "{{ unused_disks }}"
- name: Test for correct handling of duplicate volume names within a pool
include_tasks: verify-role-failed.yml
vars:
__storage_failed_regex: multiple volumes in pool.*with the same name
__storage_failed_msg: >-
Unexpected behavior w/ multiple volumes within a pool sharing a name
__storage_failed_params:
storage_pools:
- name: pool1
type: lvm
disks: "{{ unused_disks }}"
volumes:
- name: test1
type: lvm
size: "{{ volume1_size }}"
mount_point: "{{ mount_location1 }}"
- name: test1
type: lvm
size: "{{ volume2_size }}"
mount_point: "{{ mount_location2 }}"
- name: Create a pool
include_role:
name: linux-system-roles.storage
vars:
storage_pools:
- name: testpool1
type: lvm
disks: "{{ unused_disks }}"
volumes:
- name: testvol1
fs_type: ext4
size: '1g'
- name: Test for correct handling of safe_mode
include_tasks: verify-role-failed.yml
vars:
__storage_failed_regex: >-
cannot remove existing formatting on volume.*in safe mode
__storage_failed_msg: >-
Unexpected behavior w/ existing data on specified disks
__storage_failed_params:
storage_pools:
- name: testpool1
type: lvm
disks: "{{ unused_disks }}"
volumes:
- name: testvol1
fs_type: ext3
size: '1g'
- name: Test for correct handling of safe_mode with existing pool
include_tasks: verify-role-failed.yml
vars:
__storage_failed_regex: >-
cannot remove existing formatting.*and/or devices on disk.*in
safe mode
__storage_failed_msg: >-
Unexpected behavior w/ existing data on specified disks
__storage_failed_params:
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: lvm
- name: Test for correct handling of safe_mode
include_tasks: verify-role-failed.yml
vars:
__storage_failed_regex: >-
cannot remove existing formatting on volume.* in safe mode
__storage_failed_msg: >-
Unexpected behavior w/ existing data on specified disks
__storage_failed_params:
storage_volumes:
- name: test1
type: disk
fs_type: ext3
disks:
- "{{ unused_disks[0] }}"
- name: Clean up
include_role:
name: linux-system-roles.storage
vars:
storage_safe_mode: false
storage_pools:
- name: testpool1
type: lvm
disks: "{{ unused_disks }}"
state: absent
- name: Test for correct handling of pool and volume type mismatch
include_tasks: verify-role-failed.yml
vars:
storage_safe_mode: false
__storage_failed_regex: LVM volume can be placed only on LVM pool
__storage_failed_msg: Role did not report that wrong pool type was selected
__storage_failed_params:
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: partition
volumes:
- name: test1
type: lvm
size: "{{ volume1_size }}"
mount_point: "{{ mount_location1 }}"
- name: Clean up
include_role:
name: linux-system-roles.storage
vars:
storage_safe_mode: false
storage_pools:
- name: testpool1
type: lvm
disks: "{{ unused_disks }}"
state: absent