projects
/
ganeti-local
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
14947db
)
Adding qa tests for gnt-os modify
author
René Nussbaumer
<rn@google.com>
Wed, 10 Mar 2010 10:25:15 +0000
(11:25 +0100)
committer
René Nussbaumer
<rn@google.com>
Thu, 11 Mar 2010 15:19:34 +0000
(16:19 +0100)
This adds basic qa tests for gnt-os modify
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
qa/ganeti-qa.py
patch
|
blob
|
history
qa/qa_os.py
patch
|
blob
|
history
diff --git
a/qa/ganeti-qa.py
b/qa/ganeti-qa.py
index
a7f3450
..
73c01ae
100755
(executable)
--- a/
qa/ganeti-qa.py
+++ b/
qa/ganeti-qa.py
@@
-127,6
+127,8
@@
def RunOsTests():
RunTest(qa_os.TestOsValid)
RunTest(qa_os.TestOsInvalid)
RunTest(qa_os.TestOsPartiallyValid)
RunTest(qa_os.TestOsValid)
RunTest(qa_os.TestOsInvalid)
RunTest(qa_os.TestOsPartiallyValid)
+ RunTest(qa_os.TestOsModifyValid)
+ RunTest(qa_os.TestOsModifyInvalid)
def RunCommonInstanceTests(instance):
def RunCommonInstanceTests(instance):
diff --git
a/qa/qa_os.py
b/qa/qa_os.py
index
4b6fa5e
..
28c2c73
100644
(file)
--- a/
qa/qa_os.py
+++ b/
qa/qa_os.py
@@
-57,6
+57,24
@@
def TestOsDiagnose():
utils.ShellQuoteArgs(cmd)).wait(), 0)
utils.ShellQuoteArgs(cmd)).wait(), 0)
+def _TestOsModify(hvp_dict, expected_result=0):
+ """gnt-os modify"""
+ master = qa_config.GetMasterNode()
+
+ cmd = ['gnt-os', 'modify']
+
+ for hv_name, hv_params in hvp_dict.items():
+ cmd.append('-H')
+ options = []
+ for key, value in hv_params.items():
+ options.append("%s=%s" % (key, value))
+ cmd.append('%s:%s' % (hv_name, ','.join(options)))
+
+ cmd.append(_TEMP_OS_NAME)
+ AssertEqual(StartSSH(master['primary'],
+ utils.ShellQuoteArgs(cmd)).wait(), expected_result)
+
+
def _SetupTempOs(node, dir, valid):
"""Creates a temporary OS definition on the given node.
def _SetupTempOs(node, dir, valid):
"""Creates a temporary OS definition on the given node.
@@
-139,3
+157,27
@@
def TestOsInvalid():
def TestOsPartiallyValid():
"""Testing partially valid OS definition"""
return _TestOs(2)
def TestOsPartiallyValid():
"""Testing partially valid OS definition"""
return _TestOs(2)
+
+
+def TestOsModifyValid():
+ """Testing a valid os modify invocation"""
+ hv_dict = {
+ constants.HT_XEN_PVM: {
+ constants.HV_ROOT_PATH: "/dev/sda5",
+ },
+ constants.HT_XEN_HVM: {
+ constants.HV_ACPI: False,
+ constants.HV_PAE: True,
+ },
+ }
+
+ return _TestOsModify(hv_dict)
+
+
+def TestOsModifyInvalid():
+ """Testing an invalid os modify invocation"""
+ hv_dict = {
+ "blahblahblubb": {"bar": ""},
+ }
+
+ return _TestOsModify(hv_dict, 1)