Debian Codegraph @

ansible_collections/community/general/tests/unit/plugins/modules/test_pacemaker_stonith.yaml

raw
1 # Copyright (c) Dexter Le ([email protected])
2 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3 # SPDX-License-Identifier: GPL-3.0-or-later
4
5 ---
6 anchors:
7 environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: false}
8 test_cases:
9 - id: test_missing_input
10 input: {}
11 output:
12 failed: true
13 msg: "missing required arguments: name"
14 - id: test_present_minimal_input_stonith_not_exists
15 input:
16 state: present
17 name: virtual-stonith
18 stonith_type: fence_virt
19 stonith_options:
20 - "pcmk_host_list=f1"
21 stonith_operations:
22 - operation_action: monitor
23 operation_options:
24 - "interval=30s"
25 output:
26 changed: true
27 previous_value: null
28 value: " * virtual-stonith\t(stonith:fence_virt):\t Started"
29 mocks:
30 run_command:
31 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
32 environ: *env-def
33 rc: 1
34 out: ""
35 err: ""
36 - command: ["/testbin/pcs", stonith, create, virtual-stonith, fence_virt, "pcmk_host_list=f1", "op", "monitor", "interval=30s"]
37 environ: *env-def
38 rc: 0
39 out: ""
40 err: ""
41 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
42 environ: *env-def
43 rc: 0
44 out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
45 err: ""
46 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
47 environ: *env-def
48 rc: 0
49 out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
50 err: ""
51 - id: test_present_minimal_input_stonith_exists
52 input:
53 state: present
54 name: virtual-stonith
55 stonith_type: fence_virt
56 stonith_options:
57 - "pcmk_host_list=f1"
58 stonith_operations:
59 - operation_action: monitor
60 operation_options:
61 - "interval=30s"
62 output:
63 changed: false
64 previous_value: " * virtual-stonith\t(stonith:fence_virt):\t Started"
65 value: " * virtual-stonith\t(stonith:fence_virt):\t Started"
66 mocks:
67 run_command:
68 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
69 environ: *env-def
70 rc: 0
71 out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
72 err: ""
73 - command: ["/testbin/pcs", stonith, create, virtual-stonith, fence_virt, "pcmk_host_list=f1", "op", "monitor", "interval=30s"]
74 environ: *env-def
75 rc: 0
76 out: ""
77 err: "Error: 'virtual-stonith' already exists.\n"
78 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
79 environ: *env-def
80 rc: 0
81 out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
82 err: ""
83 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
84 environ: *env-def
85 rc: 0
86 out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
87 err: ""
88 - id: test_absent_minimal_input_stonith_not_exists
89 input:
90 state: absent
91 name: virtual-stonith
92 output:
93 changed: false
94 previous_value: null
95 value: null
96 mocks:
97 run_command:
98 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
99 environ: *env-def
100 rc: 1
101 out: ""
102 err: ""
103 - command: ["/testbin/pcs", stonith, remove, virtual-stonith]
104 environ: *env-def
105 rc: 1
106 out: ""
107 err: "Error: Resource 'virtual-stonith' does not exist.\n"
108 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
109 environ: *env-def
110 rc: 1
111 out: ""
112 err: ""
113 - id: test_absent_minimal_input_stonith_exists
114 input:
115 state: absent
116 name: virtual-stonith
117 output:
118 changed: true
119 previous_value: " * virtual-stonith\t(stonith:fence_virt):\t Started"
120 value: null
121 mocks:
122 run_command:
123 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
124 environ: *env-def
125 rc: 0
126 out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
127 err: ""
128 - command: ["/testbin/pcs", stonith, remove, virtual-stonith]
129 environ: *env-def
130 rc: 0
131 out: ""
132 err: "Attempting to stop: virtual-ip... Stopped\n"
133 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
134 environ: *env-def
135 rc: 1
136 out: ""
137 err: ""
138 - id: test_enabled_minimal_input_stonith_not_exists
139 input:
140 state: enabled
141 name: virtual-stonith
142 output:
143 failed: true
144 msg: "pcs failed with error (rc=1): Error: Resource 'virtual-stonith' does not exist."
145 mocks:
146 run_command:
147 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
148 environ: *env-def
149 rc: 1
150 out: ""
151 err: ""
152 - command: ["/testbin/pcs", stonith, enable, virtual-stonith]
153 environ: *env-def
154 rc: 1
155 out: ""
156 err: "Error: Resource 'virtual-stonith' does not exist."
157 - id: test_enabled_minimal_input_stonith_exists
158 input:
159 state: enabled
160 name: virtual-stonith
161 output:
162 changed: true
163 previous_value: " * virtual-stonith\t(stonith:fence_virt):\t Stopped (disabled)"
164 value: " * virtual-stonith\t(stonith:fence_virt):\t Starting"
165 mocks:
166 run_command:
167 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
168 environ: *env-def
169 rc: 0
170 out: " * virtual-stonith\t(stonith:fence_virt):\t Stopped (disabled)"
171 err: ""
172 - command: ["/testbin/pcs", stonith, enable, virtual-stonith]
173 environ: *env-def
174 rc: 0
175 out: ""
176 err: ""
177 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
178 environ: *env-def
179 rc: 0
180 out: " * virtual-stonith\t(stonith:fence_virt):\t Starting"
181 err: ""
182 - id: test_disable_minimal_input_stonith_not_exists
183 input:
184 state: disabled
185 name: virtual-stonith
186 output:
187 failed: true
188 msg: "pcs failed with error (rc=1): Error: Resource 'virtual-stonith' does not exist."
189 mocks:
190 run_command:
191 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
192 environ: *env-def
193 rc: 1
194 out: ""
195 err: ""
196 - command: ["/testbin/pcs", stonith, disable, virtual-stonith]
197 environ: *env-def
198 rc: 1
199 out: ""
200 err: "Error: Resource 'virtual-stonith' does not exist."
201 - id: test_disable_minimal_input_stonith_exists
202 input:
203 state: disabled
204 name: virtual-stonith
205 output:
206 changed: true
207 previous_value: " * virtual-stonith\t(stonith:fence_virt):\t Started"
208 value: " * virtual-stonith\t(stonith:fence_virt):\t Stopped (disabled)"
209 mocks:
210 run_command:
211 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
212 environ: *env-def
213 rc: 0
214 out: " * virtual-stonith\t(stonith:fence_virt):\t Started"
215 err: ""
216 - command: ["/testbin/pcs", stonith, disable, virtual-stonith]
217 environ: *env-def
218 rc: 0
219 out: ""
220 err: ""
221 - command: ["/testbin/pcs", stonith, status, virtual-stonith]
222 environ: *env-def
223 rc: 0
224 out: " * virtual-stonith\t(stonith:fence_virt):\t Stopped (disabled)"
225 err: ""