On Fri, Dec 20, 2013 at 10:09 AM, Hrvoje Ribicic <[email protected]> wrote:
> As query filtering was not a part of the previous workloads, this patch > adds a single example of its use. > > Signed-off-by: Hrvoje Ribicic <[email protected]> > --- > qa/rapi-workload.py | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/qa/rapi-workload.py b/qa/rapi-workload.py > index 43d1940..dbbc8a8 100755 > --- a/qa/rapi-workload.py > +++ b/qa/rapi-workload.py > @@ -241,6 +241,23 @@ def TestQueries(client, resource_name): > client.Query(resource_name, fields) > > > +def TestQueryFiltering(client, master_name): > + """ Performs queries by playing around with the only guaranteed > resource, the > + master node. > Wouldn't it also make sense to test for a query that does not yield a result? Like for example filter for certain properties of instances while no instances are there? > + > + @type client C{GanetiRapiClientWrapper} > + @param client A wrapped RAPI client. > + @type master_name string > + @param master_name The hostname of the master node. > + > + """ > + client.Query("node", ["name"], > + ["|", > + ["=", "name", master_name], > + [">", "dtotal", 0.0], > + ]) > + > + > def RemoveAllInstances(client): > """ Queries for a list of instances, then removes them all. > > @@ -541,8 +558,9 @@ def Workload(client): > > node = qa_config.AcquireNode(exclude=qa_config.GetMasterNode()) > TestNodeOperations(client, node.primary) > + TestQueryFiltering(client, node.primary) > node.Release() > - > + > nodes = qa_config.AcquireManyNodes(2) > TestGroupOperations(client, nodes[0].primary, nodes[1].primary) > qa_config.ReleaseManyNodes(nodes) > -- > 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
