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?


> +
> +  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.


>
>    # 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

Reply via email to