Revision 812e07ab test/py/cmdlib/testsupport/cmdlib_testcase.py
b/test/py/cmdlib/testsupport/cmdlib_testcase.py | ||
---|---|---|
186 | 186 |
""" |
187 | 187 |
self.mcpu.assertLogContainsRegex(expected_regex) |
188 | 188 |
|
189 |
def assertHooksCall(self, nodes, hook_path, phase, |
|
190 |
environment=None, count=None, index=0): |
|
191 |
"""Asserts a call to C{rpc.call_hooks_runner} |
|
192 |
|
|
193 |
@type nodes: list of string |
|
194 |
@param nodes: node UUID's or names hooks run on |
|
195 |
@type hook_path: string |
|
196 |
@param hook_path: path (or name) of the hook run |
|
197 |
@type phase: string |
|
198 |
@param phase: phase in which the hook runs in |
|
199 |
@type environment: dict |
|
200 |
@param environment: the environment passed to the hooks. C{None} to skip |
|
201 |
asserting it |
|
202 |
@type count: int |
|
203 |
@param count: the number of hook invocations. C{None} to skip asserting it |
|
204 |
@type index: int |
|
205 |
@param index: the index of the hook invocation to assert |
|
206 |
|
|
207 |
""" |
|
208 |
if count is not None: |
|
209 |
self.assertEqual(count, self.rpc.call_hooks_runner.call_count) |
|
210 |
|
|
211 |
args = self.rpc.call_hooks_runner.call_args[index] |
|
212 |
|
|
213 |
self.assertEqual(set(nodes), set(args[0])) |
|
214 |
self.assertEqual(hook_path, args[1]) |
|
215 |
self.assertEqual(phase, args[2]) |
|
216 |
if environment is not None: |
|
217 |
self.assertEqual(environment, args[3]) |
|
218 |
|
|
219 |
def assertSingleHooksCall(self, nodes, hook_path, phase, |
|
220 |
environment=None): |
|
221 |
"""Asserts a single call to C{rpc.call_hooks_runner} |
|
222 |
|
|
223 |
@see L{assertHooksCall} for parameter description. |
|
224 |
|
|
225 |
""" |
|
226 |
self.assertHooksCall(nodes, hook_path, phase, |
|
227 |
environment=environment, count=1) |
|
228 |
|
|
189 | 229 |
def CopyOpCode(self, opcode, **kwargs): |
190 | 230 |
"""Creates a copy of the given opcode and applies modifications to it |
191 | 231 |
|
Also available in: Unified diff