summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/testing/user/userguide/getting-started.rst60
-rw-r--r--docs/testing/user/userguide/index.rst2
-rw-r--r--qtip/cli/commands/cmd_project.py24
-rw-r--r--qtip/runner/project.py17
-rw-r--r--tests/unit/cli/cmd_project_test.py37
5 files changed, 104 insertions, 36 deletions
diff --git a/docs/testing/user/userguide/getting-started.rst b/docs/testing/user/userguide/getting-started.rst
index 8289a9c2..0f60f13f 100644
--- a/docs/testing/user/userguide/getting-started.rst
+++ b/docs/testing/user/userguide/getting-started.rst
@@ -5,10 +5,29 @@
Getting started with QTIP
*************************
-Overview
-========
+.. code-block::
+
+ pip install qtip
+ eval $(ssh-agent)
+
+ qtip create <project_name>
+ cd <project_name>
+
+ qtip setup
+ qtip run
+ qtip teardown
+
+Installation
+============
+
+Refer to `installation and configuration guide`_ for details
+
+.. _installation and configuration guide:../configguide/
-Create a new project to hold the neccessary configurations and test results
+Create
+======
+
+Create a new project to hold the necessary configurations and test results
::
qtip create <project_name>
@@ -29,32 +48,33 @@ The user would be prompted for OPNFV installer, its hostname etc
**OPNFV Scenario [unknown]: os-nosdn-nofeature-ha**
Depends on the OPNFV scenario deployed
-With the framework generated, user should now proceed on to setting up testing environment. In this step, information related to OPNFV cluster would
-be generated, such as getting the IP addresses of the nodes in System Under Test (SUT).
-::
+Setup
+=====
+
+With the project is created, user should now proceed on to setting up testing environment. In this step, ssh connection
+to hosts in SUT will be configured automatically::
cd <project_name>
$ qtip setup
-QTIP uses `ssh-agent` for authentication. It is critical that it started and stopped in the correct way.
-
+Run
+===
-ssh-agent
-=========
+QTIP uses ``ssh-agent`` for authentication of ssh connection to hosts in SUT. It must be started correctly before
+running the tests::
-ssh-agent is used to hold the private keys for RSA, DCA authentication. In order to start the process
-::
+ eval $(ssh-agent)
- $ eval $(ssh-agent)
+Then run test with ``qtip run``
-This would start the agent in background. One must now be able to execute QTIP
-::
+Teardown
+========
- $ qtip run
+Clean up the temporary folder on target hosts.
-However, if QTIP is not working because of `ssh-agent`, one should kill the process as follows
-::
+.. note:: The installed packages for testing won't be uninstalled.
- $ eval $(ssh-agent -k)
+One more thing
+==============
-Then start the agent again as described above.
+You may use ``-v`` for verbose output (``-vvv`` for more, ``-vvvv`` to enable connection debugging)
diff --git a/docs/testing/user/userguide/index.rst b/docs/testing/user/userguide/index.rst
index 9b6ab888..e6eaea59 100644
--- a/docs/testing/user/userguide/index.rst
+++ b/docs/testing/user/userguide/index.rst
@@ -12,7 +12,7 @@ QTIP User Guide
:maxdepth: 2
overview.rst
+ getting-started.rst
cli.rst
api.rst
compute.rst
- getting-started.rst
diff --git a/qtip/cli/commands/cmd_project.py b/qtip/cli/commands/cmd_project.py
index eefabfc0..f7ac3a83 100644
--- a/qtip/cli/commands/cmd_project.py
+++ b/qtip/cli/commands/cmd_project.py
@@ -15,6 +15,9 @@ from qtip.cli import utils
from qtip.runner import project
+CONTEXT_SETTINGS = dict(ignore_unknown_options=True, allow_extra_args=True, )
+
+
class AliasedGroup(click.Group):
def get_command(self, ctx, cmd_name):
@@ -72,16 +75,19 @@ def create(pod, installer, master_host, scenario, name, template):
extra_vars=utils.join_vars(**extra_vars)))
-@cli.command(help='Setup testing environment')
-def setup():
- project.setup()
+@cli.command(context_settings=CONTEXT_SETTINGS, help='Setup testing environment')
+@click.pass_context
+def setup(ctx):
+ project.setup(ctx.args)
-@cli.command(help='Execute testing plan')
-def run():
- project.run()
+@cli.command(context_settings=CONTEXT_SETTINGS, help='Execute testing plan')
+@click.pass_context
+def run(ctx):
+ project.run(ctx.args)
-@cli.command(help='Teardown testing environment')
-def teardown():
- project.teardown()
+@cli.command(context_settings=CONTEXT_SETTINGS, help='Teardown testing environment')
+@click.pass_context
+def teardown(ctx):
+ project.teardown(ctx.args)
diff --git a/qtip/runner/project.py b/qtip/runner/project.py
index 9eadc9db..90d1e079 100644
--- a/qtip/runner/project.py
+++ b/qtip/runner/project.py
@@ -10,13 +10,18 @@
import os
-def setup():
- os.system('ansible-playbook setup.yml')
+def convert(vals):
+ if vals:
+ return " ".join(vals)
-def run():
- os.system('ansible-playbook run.yml')
+def setup(extra_val=None):
+ os.system('ansible-playbook setup.yml {}'.format(convert(extra_val)))
-def teardown():
- os.system('ansible-playbook teardown.yml')
+def run(extra_val=None):
+ os.system('ansible-playbook run.yml {}'.format(convert(extra_val)))
+
+
+def teardown(extra_val=None):
+ os.system('ansible-playbook teardown.yml {}'.format(convert(extra_val)))
diff --git a/tests/unit/cli/cmd_project_test.py b/tests/unit/cli/cmd_project_test.py
new file mode 100644
index 00000000..8b9216fa
--- /dev/null
+++ b/tests/unit/cli/cmd_project_test.py
@@ -0,0 +1,37 @@
+###############################################################
+# Copyright (c) 2017 taseer94@gmail.com and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from click.testing import CliRunner
+import os
+import pytest
+
+from qtip.cli.entry import cli
+
+
+@pytest.fixture(scope='module')
+def runner():
+ return CliRunner()
+
+
+def test_run(mocker, runner):
+ mocker.patch('os.system')
+ runner.invoke(cli, ['run', '-vvv'])
+ os.system.assert_called_once_with('ansible-playbook run.yml -vvv')
+
+
+def test_setup(mocker, runner):
+ mocker.patch('os.system')
+ runner.invoke(cli, ['setup', '-vvv'])
+ os.system.assert_called_once_with('ansible-playbook setup.yml -vvv')
+
+
+def test_teardown(mocker, runner):
+ mocker.patch('os.system')
+ runner.invoke(cli, ['teardown', '-vvv'])
+ os.system.assert_called_once_with('ansible-playbook teardown.yml -vvv')