diff --git a/Makefile.am b/Makefile.am index 3f67337ab93b4ec1f9a9960b9379f532e7073310..48a6f5cfe0b90bf139949722fb3854275d0e263e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -454,6 +454,7 @@ qa_scripts = \ qa/qa_daemon.py \ qa/qa_env.py \ qa/qa_error.py \ + qa/qa_group.py \ qa/qa_instance.py \ qa/qa_node.py \ qa/qa_os.py \ @@ -767,6 +768,17 @@ lint_python_code = \ $(DOCPP) \ $(PYTHON_BOOTSTRAP) +pep8_python_code = \ + ganeti \ + ganeti/http/server.py \ + $(dist_sbin_SCRIPTS) \ + $(dist_tools_PYTHON) \ + $(pkglib_python_scripts) \ + $(BUILD_BASH_COMPLETION) \ + $(DOCPP) \ + $(PYTHON_BOOTSTRAP) \ + qa + test/daemon-util_unittest.bash: daemons/daemon-util test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner @@ -1087,7 +1099,7 @@ lint: $(BUILT_SOURCES) echo '"pep8" not found during configure' >&2; \ else \ $(PEP8) --repeat --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \ - $(lint_python_code); \ + $(pep8_python_code); \ fi $(PYLINT) $(LINT_OPTS) $(lint_python_code) cd $(top_srcdir)/qa && \ diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index 0cb88ff022139018946d45a35256aacec70648f6..fc7abbcfa9b3acc202059f2ab2bb30dd46983d55 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -54,7 +54,7 @@ def _FormatHeader(line, end=72): """ line = "---- " + line + " " - line += "-" * (end-len(line)) + line += "-" * (end - len(line)) line = line.rstrip() return line diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index bfda23674505602eb7cec7da713ac736b23d9e3b..bd3d737d5d6abc2dd5edad52c227a00d480eab96 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -40,6 +40,7 @@ from qa_utils import AssertEqual, AssertCommand, GetCommandOutput #: cluster verify command _CLUSTER_VERIFY = ["gnt-cluster", "verify"] + def _RemoveFileFromAllNodes(filename): """Removes a file from all nodes. @@ -231,14 +232,14 @@ def TestClusterReservedLvs(): (False, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", ""]), (False, ["lvcreate", "-L1G", "-nqa-test", "xenvg"]), - (True, _CLUSTER_VERIFY), + (True, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", "xenvg/qa-test,.*/other-test"]), (False, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", ".*/qa-.*"]), (False, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", ""]), - (True, _CLUSTER_VERIFY), + (True, _CLUSTER_VERIFY), (False, ["lvremove", "-f", "xenvg/qa-test"]), (False, _CLUSTER_VERIFY), ]: @@ -251,19 +252,19 @@ def TestClusterModifyBe(): # mem (False, ["gnt-cluster", "modify", "-B", "memory=256"]), (False, ["sh", "-c", "gnt-cluster info|grep '^ *memory: 256$'"]), - (True, ["gnt-cluster", "modify", "-B", "memory=a"]), + (True, ["gnt-cluster", "modify", "-B", "memory=a"]), (False, ["gnt-cluster", "modify", "-B", "memory=128"]), (False, ["sh", "-c", "gnt-cluster info|grep '^ *memory: 128$'"]), # vcpus (False, ["gnt-cluster", "modify", "-B", "vcpus=4"]), (False, ["sh", "-c", "gnt-cluster info|grep '^ *vcpus: 4$'"]), - (True, ["gnt-cluster", "modify", "-B", "vcpus=a"]), + (True, ["gnt-cluster", "modify", "-B", "vcpus=a"]), (False, ["gnt-cluster", "modify", "-B", "vcpus=1"]), (False, ["sh", "-c", "gnt-cluster info|grep '^ *vcpus: 1$'"]), # auto_balance (False, ["gnt-cluster", "modify", "-B", "auto_balance=False"]), (False, ["sh", "-c", "gnt-cluster info|grep '^ *auto_balance: False$'"]), - (True, ["gnt-cluster", "modify", "-B", "auto_balance=1"]), + (True, ["gnt-cluster", "modify", "-B", "auto_balance=1"]), (False, ["gnt-cluster", "modify", "-B", "auto_balance=True"]), (False, ["sh", "-c", "gnt-cluster info|grep '^ *auto_balance: True$'"]), ]: @@ -274,6 +275,7 @@ def TestClusterModifyBe(): if bep: AssertCommand(["gnt-cluster", "modify", "-B", bep]) + def TestClusterInfo(): """gnt-cluster info""" AssertCommand(["gnt-cluster", "info"]) @@ -306,7 +308,7 @@ def TestClusterRenewCrypto(): ["--new-cluster-domain-secret", "--cluster-domain-secret=/dev/null"], ] for i in conflicting: - AssertCommand(cmd+i, fail=True) + AssertCommand(cmd + i, fail=True) # Invalid RAPI certificate cmd = ["gnt-cluster", "renew-crypto", "--force", diff --git a/qa/qa_env.py b/qa/qa_env.py index e9293b0765c11cbe8aa16c27ec2e17e327436813..986128b2fe143b0d7061895d3403a62c523449cb 100644 --- a/qa/qa_env.py +++ b/qa/qa_env.py @@ -42,7 +42,7 @@ def TestGanetiCommands(): """Test availibility of Ganeti commands. """ - cmds = ( ["gnt-backup", "--version"], + cmds = (["gnt-backup", "--version"], ["gnt-cluster", "--version"], ["gnt-debug", "--version"], ["gnt-instance", "--version"], @@ -76,7 +76,7 @@ def TestIcmpPing(): seccmd = [pingsecondary, "-e"] for i in nodes: pricmd.append(i["primary"]) - if i.has_key("secondary"): + if "secondary" in i: seccmd.append(i["secondary"]) pristr = utils.ShellQuoteArgs(pricmd) diff --git a/qa/qa_error.py b/qa/qa_error.py index 131b69bc8d4e6d25f30bfc35fd7408857bfe0ebe..8b5d4b90308ffa40f53e951377a3963e51563203 100644 --- a/qa/qa_error.py +++ b/qa/qa_error.py @@ -23,6 +23,7 @@ """ + class Error(Exception): """An error occurred during Q&A testing. diff --git a/qa/qa_node.py b/qa/qa_node.py index 434de3832386f58766eb8a96844a043a72d92e67..8b2d406f3ee30e6c0e6864aa51ed51be82eb5199 100644 --- a/qa/qa_node.py +++ b/qa/qa_node.py @@ -275,7 +275,7 @@ def TestOutOfBand(): # Power off on master without options should fail AssertCommand(["gnt-node", "power", "-f", "off", master_name], fail=True) # With force master it should still fail - AssertCommand(["gnt-node", "power", "-f", "--ignore-status", "off", + AssertCommand(["gnt-node", "power", "-f", "--ignore-status", "off", master_name], fail=True) @@ -302,7 +302,7 @@ def TestOutOfBand(): AssertCommand(["gnt-node", "health"], fail=True) # Correct Data, exit 0 - _UpdateOobFile(data_path, serializer.DumpJson({ "powered": True })) + _UpdateOobFile(data_path, serializer.DumpJson({"powered": True})) AssertCommand(["gnt-node", "power", "status", node_name]) _AssertOobCall(verify_path, "power-status %s" % full_node_name) @@ -315,7 +315,6 @@ def TestOutOfBand(): AssertCommand(["gnt-node", "health"]) - # Those commands should fail as they expect no data regardless of exit 0 AssertCommand(["gnt-node", "power", "on", node_name], fail=True) _AssertOobCall(verify_path, "power-on %s" % full_node_name)