Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-ganeti
Commits
7ccb3074
Commit
7ccb3074
authored
Dec 02, 2008
by
Guido Trotter
Browse files
Fix hooks_unittest with new rpc call structure
Reviewed-by: iustinp
parent
25361b9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/ganeti.hooks_unittest.py
View file @
7ccb3074
...
...
@@ -34,6 +34,7 @@ from ganeti import mcpu
from
ganeti
import
backend
from
ganeti
import
constants
from
ganeti
import
cmdlib
from
ganeti
import
rpc
from
ganeti.constants
import
HKR_SUCCESS
,
HKR_FAIL
,
HKR_SKIP
from
mocks
import
FakeConfig
,
FakeProc
,
FakeContext
...
...
@@ -197,33 +198,34 @@ class TestHooksMaster(unittest.TestCase):
def
_call_nodes_false
(
node_list
,
hpath
,
phase
,
env
):
"""Fake call_hooks_runner function.
Returns:
- list of False values with the same len as the node_list argument
@rtype: dict of node -> L{rpc.RpcResult} with an rpc error
@return: rpc failure from all nodes
"""
return
[
False
for
node_name
in
node_list
]
return
dict
([(
node
,
rpc
.
RpcResult
(
'error'
,
failed
=
True
,
node
=
node
,
call
=
'FakeError'
))
for
node
in
node_list
])
@
staticmethod
def
_call_script_fail
(
node_list
,
hpath
,
phase
,
env
):
"""Fake call_hooks_runner function.
Returns:
- list of False values with the same len as the node_list argument
@rtype: dict of node -> L{rpc.RpcResult} with a failed script result
@return: script execution failure from all nodes
"""
return
dict
([(
node
_name
,
[(
"u
nit
test"
,
constants
.
HKR_FAIL
,
"err
or
"
)]
)
for
node
_name
in
node_list
])
return
dict
([(
node
,
rpc
.
RpcResult
(
[(
"utest"
,
constants
.
HKR_FAIL
,
"err"
)]
,
node
=
node
,
call
=
'FakeScriptFail'
))
for
node
in
node_list
])
@
staticmethod
def
_call_script_succeed
(
node_list
,
hpath
,
phase
,
env
):
"""Fake call_hooks_runner function.
Returns:
- list of False values with the same len as the node_list argument
@rtype: dict of node -> L{rpc.RpcResult} with a successful script result
@return: script execution from all nodes
"""
return
dict
([(
node
_name
,
[(
"u
nit
test"
,
constants
.
HKR_SUCCESS
,
"ok"
)]
)
for
node
_name
in
node_list
])
return
dict
([(
node
,
rpc
.
RpcResult
(
[(
"utest"
,
constants
.
HKR_SUCCESS
,
"ok"
)]
,
node
=
node
,
call
=
'FakeScriptOk'
))
for
node
in
node_list
])
def
setUp
(
self
):
self
.
op
=
opcodes
.
OpCode
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment