Commit a5b9d725 authored by Iustin Pop's avatar Iustin Pop
Browse files

Revive RAPI QA tests for 2.0-style RAPI

This patch fixes the RAPI QA tests to work with today's RAPI code and
also does some other minor improvements:
  - QA: only create the cluster if so configured (‘create-cluster’ key),
    this allows running parts of the QA suite against existing clusters
  - export the “hvparams” for instances in RAPI

Reviewed-by: imsnah
parent 3d103742
......@@ -35,7 +35,7 @@ I_FIELDS = ["name", "admin_state", "os",
"disk_template",
"nic.ips", "nic.macs", "nic.bridges",
"disk.sizes",
"beparams",
"beparams", "hvparams",
"oper_state", "oper_ram", "status",
"tags"]
......
......@@ -74,8 +74,9 @@ def SetupCluster():
"""Initializes the cluster.
"""
RunTest(qa_cluster.TestClusterInit)
RunTest(qa_node.TestNodeAddAll)
if qa_config.TestEnabled('create-cluster'):
RunTest(qa_cluster.TestClusterInit)
RunTest(qa_node.TestNodeAddAll)
if qa_config.TestEnabled('node-info'):
RunTest(qa_node.TestNodeInfo)
......@@ -308,7 +309,8 @@ def main():
finally:
qa_config.ReleaseNode(pnode)
RunTest(qa_node.TestNodeRemoveAll)
if qa_config.TestEnabled('create-cluster'):
RunTest(qa_node.TestNodeRemoveAll)
if qa_config.TestEnabled('cluster-destroy'):
RunTest(qa_cluster.TestClusterDestroy)
......
......@@ -38,6 +38,7 @@
"tags": true,
"rapi": true,
"create-cluster": true,
"cluster-verify": true,
"cluster-info": true,
"cluster-burnin": true,
......
......@@ -41,10 +41,11 @@ NoProxyOpener = urllib2.build_opener(urllib2.ProxyHandler({}))
INSTANCE_FIELDS = ("name", "os", "pnode", "snodes",
"admin_state", "admin_ram",
"disk_template", "ip", "mac", "bridge",
"sda_size", "sdb_size", "vcpus",
"oper_state", "status", "tags")
"admin_state",
"disk_template", "disk.sizes",
"nic.ips", "nic.macs", "nic.bridges",
"beparams", "hvparams",
"oper_state", "oper_ram", "status", "tags")
NODE_FIELDS = ("name", "dtotal", "dfree",
"mtotal", "mnode", "mfree",
......@@ -119,8 +120,8 @@ def TestEmptyCluster():
def _VerifyNodes(data):
master_entry = {
"name": master_name,
"uri": "/nodes/%s" % master_name,
"id": master_name,
"uri": "/2/nodes/%s" % master_name,
}
AssertIn(master_entry, data)
......@@ -131,13 +132,13 @@ def TestEmptyCluster():
_DoTests([
("/", None),
("/info", _VerifyInfo),
("/tags", None),
("/nodes", _VerifyNodes),
("/nodes?bulk=1", _VerifyNodesBulk),
("/instances", []),
("/instances?bulk=1", []),
("/os", None),
("/2/info", _VerifyInfo),
("/2/tags", None),
("/2/nodes", _VerifyNodes),
("/2/nodes?bulk=1", _VerifyNodesBulk),
("/2/instances", []),
("/2/instances?bulk=1", []),
("/2/os", None),
])
......@@ -159,9 +160,9 @@ def TestInstance(instance):
_VerifyInstance(instance_data)
_DoTests([
("/instances/%s" % instance["name"], _VerifyInstance),
("/instances", _VerifyInstancesList),
("/instances?bulk=1", _VerifyInstancesBulk),
("/2/instances/%s" % instance["name"], _VerifyInstance),
("/2/instances", _VerifyInstancesList),
("/2/instances?bulk=1", _VerifyInstancesBulk),
])
......@@ -183,9 +184,9 @@ def TestNode(node):
_VerifyNode(node_data)
_DoTests([
("/nodes/%s" % node["primary"], _VerifyNode),
("/nodes", _VerifyNodesList),
("/nodes?bulk=1", _VerifyNodesBulk),
("/2/nodes/%s" % node["primary"], _VerifyNode),
("/2/nodes", _VerifyNodesList),
("/2/nodes?bulk=1", _VerifyNodesBulk),
])
......@@ -194,11 +195,11 @@ def TestTags(kind, name, tags):
"""
if kind == constants.TAG_CLUSTER:
uri = "/tags"
uri = "/2/tags"
elif kind == constants.TAG_NODE:
uri = "/nodes/%s/tags" % name
uri = "/2/nodes/%s/tags" % name
elif kind == constants.TAG_INSTANCE:
uri = "/instances/%s/tags" % name
uri = "/2/instances/%s/tags" % name
else:
raise errors.ProgrammerError("Unknown tag kind")
......
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