Commit a4c589d2 authored by Hrvoje Ribicic's avatar Hrvoje Ribicic
Browse files

Add network tag tests to QA



The QA did not have a test for network tags until now, and this patch
remedies the situation.
Signed-off-by: default avatarHrvoje Ribicic <riba@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 92ea7d79
...@@ -379,6 +379,7 @@ def RunNetworkTests(): ...@@ -379,6 +379,7 @@ def RunNetworkTests():
""" """
RunTestIf("network", qa_network.TestNetworkAddRemove) RunTestIf("network", qa_network.TestNetworkAddRemove)
RunTestIf("network", qa_network.TestNetworkConnect) RunTestIf("network", qa_network.TestNetworkConnect)
RunTestIf(["network", "tags"], qa_network.TestNetworkTags)
def RunGroupRwTests(): def RunGroupRwTests():
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
""" """
import qa_config import qa_config
import qa_tags
import qa_utils import qa_utils
from qa_utils import AssertCommand from qa_utils import AssertCommand
...@@ -56,6 +57,14 @@ def TestNetworkAddRemove(): ...@@ -56,6 +57,14 @@ def TestNetworkAddRemove():
AssertCommand(["gnt-network", "remove", network2]) 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(): def TestNetworkConnect():
"""gnt-network connect/disconnect""" """gnt-network connect/disconnect"""
(group1, ) = qa_utils.GetNonexistentGroups(1) (group1, ) = qa_utils.GetNonexistentGroups(1)
......
...@@ -457,6 +457,8 @@ def TestTags(kind, name, tags): ...@@ -457,6 +457,8 @@ def TestTags(kind, name, tags):
uri = "/2/instances/%s/tags" % name uri = "/2/instances/%s/tags" % name
elif kind == constants.TAG_NODEGROUP: elif kind == constants.TAG_NODEGROUP:
uri = "/2/groups/%s/tags" % name uri = "/2/groups/%s/tags" % name
elif kind == constants.TAG_NETWORK:
uri = "/2/networks/%s/tags" % name
else: else:
raise errors.ProgrammerError("Unknown tag kind") raise errors.ProgrammerError("Unknown tag kind")
......
...@@ -38,6 +38,7 @@ _KIND_TO_COMMAND = { ...@@ -38,6 +38,7 @@ _KIND_TO_COMMAND = {
constants.TAG_NODE: "gnt-node", constants.TAG_NODE: "gnt-node",
constants.TAG_INSTANCE: "gnt-instance", constants.TAG_INSTANCE: "gnt-instance",
constants.TAG_NODEGROUP: "gnt-group", constants.TAG_NODEGROUP: "gnt-group",
constants.TAG_NETWORK: "gnt-network",
} }
...@@ -83,3 +84,8 @@ def TestGroupTags(group): ...@@ -83,3 +84,8 @@ def TestGroupTags(group):
def TestInstanceTags(instance): def TestInstanceTags(instance):
"""gnt-instance tags""" """gnt-instance tags"""
_TestTags(constants.TAG_INSTANCE, instance.name) _TestTags(constants.TAG_INSTANCE, instance.name)
def TestNetworkTags(network):
"""gnt-network tags"""
_TestTags(constants.TAG_NETWORK, network)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment