On Fri, Dec 20, 2013 at 2:27 PM, Hrvoje Ribicic <[email protected]> wrote:

> On Fri, Dec 20, 2013 at 11:08 AM, Helga Velroyen <[email protected]>wrote:
>
>>
>>
>>
>> On Fri, Dec 20, 2013 at 10:09 AM, Hrvoje Ribicic <[email protected]> wrote:
>>
>>> This patch adds a generic way to test tagging of various entities via
>>> RAPI. More tags testing will be added as other entitt tests are added.
>>>
>>> Signed-off-by: Hrvoje Ribicic <[email protected]>
>>> ---
>>>  qa/rapi-workload.py | 44 ++++++++++++++++++++++++++++++++++++++++++++
>>>  1 file changed, 44 insertions(+)
>>>
>>> diff --git a/qa/rapi-workload.py b/qa/rapi-workload.py
>>> index 679425a..71cae24 100755
>>> --- a/qa/rapi-workload.py
>>> +++ b/qa/rapi-workload.py
>>> @@ -156,6 +156,40 @@ def Finish(client, fn, *args, **kwargs):
>>>      return None
>>>
>>>
>>> +def TestTags(client, get_fn, add_fn, delete_fn, *args):
>>> +  """ Tests whether tagging works.
>>> +
>>> +  @type client C{GanetiRapiClientWrapper}
>>> +  @param client The client wrapper.
>>> +  @type get_fn function
>>> +  @param get_fn A Get*Tags function of the client.
>>> +  @type add_fn function
>>> +  @param add_fn An Add*Tags function of the client.
>>> +  @type delete_fn function
>>> +  @param delete_fn A Delete*Tags function of the client.
>>> +
>>> +  To allow this method to work for all tagging functions of the client,
>>> use
>>> +  named methods.
>>> +
>>> +  """
>>> +  get_fn(*args)
>>> +
>>> +  tags = ["tag1", "tag2", "tag3"]
>>> +  Finish(client, add_fn, *args, tags=tags, dry_run=True)
>>> +  Finish(client, add_fn, *args, tags=tags)
>>> +
>>> +  get_fn(*args)
>>> +
>>> +  Finish(client, delete_fn, *args, tags=tags[:1], dry_run=True)
>>> +  Finish(client, delete_fn, *args, tags=tags[:1])
>>> +
>>> +  get_fn(*args)
>>> +
>>> +  Finish(client, delete_fn, *args, tags=tags[1:])
>>>
>>
>> No dry run here?
>>
>
> Just one use of dry_run is proof enough that it works - the next deletion
> would complain of tags being re-deleted.
> To make the test more sleek, I did not overdo it with the dry_run-s.
>

Okay, I get it.


>
>
>>
>>
>>> +
>>> +  get_fn(*args)
>>> +
>>> +
>>>  def Workload(client):
>>>    """ The actual RAPI workload used for tests.
>>>
>>> @@ -163,6 +197,7 @@ def Workload(client):
>>>    @param client A wrapped RAPI client.
>>>
>>>    """
>>> +  nodes, _instance_names = parseConfig(config)
>>>
>>
>> I don't see where these are used.
>>
>
> Actually, this is yet another relic of rebasing.
>

>
>>
>>
>>>
>>>    # First just the simple information retrievals
>>>    client.GetVersion()
>>> @@ -183,6 +218,15 @@ def Workload(client):
>>>
>>>    Finish(client, client.RedistributeConfig)
>>>
>>> +  TestTags(client, client.GetClusterTags, client.AddClusterTags,
>>> +           client.DeleteClusterTags)
>>> +
>>> +  # Generously assume the master is present
>>> +  node = qa_config.AcquireNode()
>>> +  TestTags(client, client.GetNodeTags, client.AddNodeTags,
>>> +           client.DeleteNodeTags, node.primary)
>>> +  node.Release()
>>> +
>>>
>>>  def Usage():
>>>    sys.stderr.write("Usage:\n\trapi-workload.py qa-config-file")
>>> --
>>> 1.8.5.1
>>>
>>>
>>
>>
>> --
>> --
>> 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
>>
>
> Interdiff for the relic deletion:
>
> diff --git a/qa/rapi-workload.py b/qa/rapi-workload.py
> index 69fdc54..a8bac66 100755
> --- a/qa/rapi-workload.py
> +++ b/qa/rapi-workload.py
> @@ -197,7 +197,6 @@ def Workload(client):
>    @param client A wrapped RAPI client.
>
>    """
> -  nodes, _instance_names = parseConfig(config)
>
>    # First just the simple information retrievals
>    client.GetVersion()
>
>
>


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

Reply via email to