Add network tag tests to QA
authorHrvoje Ribicic <riba@google.com>
Thu, 12 Dec 2013 15:36:04 +0000 (16:36 +0100)
committerHrvoje Ribicic <riba@google.com>
Mon, 16 Dec 2013 15:31:37 +0000 (16:31 +0100)
The QA did not have a test for network tags until now, and this patch
remedies the situation.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

qa/ganeti-qa.py
qa/qa_network.py
qa/qa_rapi.py
qa/qa_tags.py

index c58b959..5fb13d2 100755 (executable)
@@ -379,6 +379,7 @@ def RunNetworkTests():
   """
   RunTestIf("network", qa_network.TestNetworkAddRemove)
   RunTestIf("network", qa_network.TestNetworkConnect)
+  RunTestIf(["network", "tags"], qa_network.TestNetworkTags)
 
 
 def RunGroupRwTests():
index 5648fd6..aac83d5 100644 (file)
@@ -24,6 +24,7 @@
 """
 
 import qa_config
+import qa_tags
 import qa_utils
 
 from qa_utils import AssertCommand
@@ -56,6 +57,14 @@ def TestNetworkAddRemove():
   AssertCommand(["gnt-network", "remove", network2])
 
 
+def TestNetworkTags():
+  """gnt-network tags"""
+  (network, ) = GetNonexistentNetworks(1)
+  AssertCommand(["gnt-network", "add", "--network", "192.0.2.0/30", network])
+  qa_tags.TestNetworkTags(network)
+  AssertCommand(["gnt-network", "remove", network])
+
+
 def TestNetworkConnect():
   """gnt-network connect/disconnect"""
   (group1, ) = qa_utils.GetNonexistentGroups(1)
index 0ebe635..a68b819 100644 (file)
@@ -457,6 +457,8 @@ def TestTags(kind, name, tags):
     uri = "/2/instances/%s/tags" % name
   elif kind == constants.TAG_NODEGROUP:
     uri = "/2/groups/%s/tags" % name
+  elif kind == constants.TAG_NETWORK:
+    uri = "/2/networks/%s/tags" % name
   else:
     raise errors.ProgrammerError("Unknown tag kind")
 
index 834f7a8..7480b16 100644 (file)
@@ -38,6 +38,7 @@ _KIND_TO_COMMAND = {
   constants.TAG_NODE: "gnt-node",
   constants.TAG_INSTANCE: "gnt-instance",
   constants.TAG_NODEGROUP: "gnt-group",
+  constants.TAG_NETWORK: "gnt-network",
   }
 
 
@@ -83,3 +84,8 @@ def TestGroupTags(group):
 def TestInstanceTags(instance):
   """gnt-instance tags"""
   _TestTags(constants.TAG_INSTANCE, instance.name)
+
+
+def TestNetworkTags(network):
+  """gnt-network tags"""
+  _TestTags(constants.TAG_NETWORK, network)