On Fri, Dec 20, 2013 at 11:25 AM, Helga Velroyen <[email protected]> wrote:
> > > > On Fri, Dec 20, 2013 at 10:09 AM, Hrvoje Ribicic <[email protected]> wrote: > >> The query requests are done to receive data bout a certain resource >> > > s/bout/about > ACK > > >> type. With tests for all the resources barring networks in place, the >> query workloads can be added at the point where the existence of enough >> resources in the system can be confirmed, making the results of the >> queries meaningful. >> >> Signed-off-by: Hrvoje Ribicic <[email protected]> >> --- >> qa/rapi-workload.py | 38 ++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 38 insertions(+) >> >> diff --git a/qa/rapi-workload.py b/qa/rapi-workload.py >> index 9cd717b..43d1940 100755 >> --- a/qa/rapi-workload.py >> +++ b/qa/rapi-workload.py >> @@ -215,6 +215,32 @@ def TestGetters(client): >> client.GetGroups(bulk=True) >> >> >> +def TestQueries(client, resource_name): >> + """ Finds out which fields are present for a given resource type, and >> attempts >> + to retrieve their values for all present resources. >> + >> + @type client C{GanetiRapiClientWrapper} >> + @param client A wrapped RAPI client. >> + @type resource_name string >> + @param resource_name The name of the resource to use. >> > > colons! > > Will be done in one patch later to minimize rebasing. > + >> + """ >> + >> + FIELDS_KEY = "fields" >> + >> + query_res = client.QueryFields(resource_name) >> + >> + if query_res is None or FIELDS_KEY not in query_res or \ >> + len(query_res[FIELDS_KEY]) == 0: >> + return >> + >> + field_entries = query_res[FIELDS_KEY] >> + >> + fields = map(lambda e: e["name"], field_entries) >> + >> + client.Query(resource_name, fields) >> + >> + >> def RemoveAllInstances(client): >> """ Queries for a list of instances, then removes them all. >> >> @@ -276,6 +302,8 @@ def TestSingleInstance(client, instance_name, >> alternate_name, node_one, >> >> Finish(client, client.GetInstanceInfo, instance_name, static=True) >> >> + TestQueries(client, "instance") >> + >> TestTags(client, client.GetInstanceTags, client.AddInstanceTags, >> client.DeleteInstanceTags, instance_name) >> >> @@ -411,6 +439,8 @@ def TestNodeOperations(client, non_master_node): >> MarkUnmarkNode(client, non_master_node, "powered") >> MarkUnmarkNode(client, non_master_node, "offline") >> >> + TestQueries(client, "node") >> + >> >> def TestGroupOperations(client, node, another_node): >> """ Tests various operations related to groups only. >> @@ -437,6 +467,8 @@ def TestGroupOperations(client, node, another_node): >> >> client.GetGroup(TEST_GROUP_NAME) >> >> + TestQueries(client, "group") >> + >> TestTags(client, client.GetGroupTags, client.AddGroupTags, >> client.DeleteGroupTags, TEST_GROUP_NAME) >> >> @@ -501,6 +533,12 @@ def Workload(client): >> instance_one.Release() >> qa_config.ReleaseManyNodes(nodes) >> >> + # Test all the queries which involve resources that do not have >> functions >> + # of their own >> + TestQueries(client, "lock") >> + TestQueries(client, "job") >> + TestQueries(client, "export") >> + >> node = qa_config.AcquireNode(exclude=qa_config.GetMasterNode()) >> TestNodeOperations(client, node.primary) >> node.Release() >> -- >> 1.8.5.1 >> >> > > LGTM, thanks > > -- > -- > Helga Velroyen | Software Engineer | [email protected] | > > Google Germany GmbH > Dienerstr. 12 > 80331 München > > Registergericht und -nummer: Hamburg, HRB 86891 > Sitz der Gesellschaft: Hamburg > Geschäftsführer: Graham Law, Christine Elizabeth Flores > Thanks for the review, due to this resolving to only a typo, not sending an interdiff
