Interdiff:
diff --git a/qa/rapi-workload.py b/qa/rapi-workload.py
index 121535f..0df49b9 100755
--- a/qa/rapi-workload.py
+++ b/qa/rapi-workload.py
@@ -303,7 +303,13 @@ def TestQueryFiltering(client, master_name):
client.Query("node", ["name"],
["|",
["=", "name", master_name],
- [">", "dtotal", 0.0],
+ [">", "dtotal", 0],
+ ])
+
+ client.Query("instance", ["name"],
+ ["|",
+ ["=", "name", "NonexistentInstance"],
+ [">", "oper_ram", 0],
])
On Fri, Dec 20, 2013 at 2:54 PM, Hrvoje Ribicic <[email protected]> wrote:
>
>
>
> On Fri, Dec 20, 2013 at 11:27 AM, Helga Velroyen <[email protected]>wrote:
>
>>
>>
>>
>> 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?
>>
>>
>
> Yes, that's a good point - somebody might be relying on behavior like that
> and it could get rewarded with an error in later versions.
> I will add a simple instance query to check for this as well in the coming
> interdiff.
>
>
>> +
>>> + @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
>>
>
>