[Verify] Fix rally verify installplugin cmd

Very often Tempest plugins are inside projects and requirements for
plugins are listed in the test-requirements.txt file. This patch is
intended to resolve the issue.

Also, this patch changes Tempest plugin URL in the rally_verify.py
file from

  https://git.openstack.org/openstack/ceilometer

to

  https://git.openstack.org/openstack/keystone

to verify the issue.

Change-Id: I7c3b7849bd0ce140a8fd8d4a1438b36d483dd54b
This commit is contained in:
Yaroslav Lobankov 2016-10-06 16:11:50 +03:00
parent de707566d8
commit ef85a9a2ba
3 changed files with 28 additions and 8 deletions

View File

@ -299,18 +299,32 @@ class Tempest(object):
"""Install Tempest plugin for local Tempest repo."""
LOG.info(_("Installing Tempest plugin from %s for "
"deployment: %s") % (self.plugin_source, self.deployment))
version = self.plugin_version or "master"
egg = re.sub("\.git$", "",
os.path.basename(self.plugin_source.strip("/")))
version = self.plugin_version or "master"
cmd = ["pip", "install", "--no-deps",
"--src", self.path("plugins/system-wide"), "-e",
"git+{0}@{1}#egg={2}".format(self.plugin_source, version, egg)]
# Very often Tempest plugins are inside projects and requirements
# for plugins are listed in the test-requirements.txt file.
test_reqs_path = self.path("plugins/system-wide/"
"%s/test-requirements.txt" % egg)
if not self._system_wide:
cmd.remove("--no-deps")
cmd.remove(self.path("plugins/system-wide"))
cmd.insert(0, self.path("tools/with_venv.sh"))
cmd.insert(4, self.path("plugins"))
test_reqs_path = self.path("plugins/"
"%s/test-requirements.txt" % egg)
check_output(cmd, cwd=self.path())
if os.path.exists(test_reqs_path):
cmd = ["pip", "install", "-r", test_reqs_path]
if not self._system_wide:
cmd.insert(0, self.path("tools/with_venv.sh"))
check_output(cmd, cwd=self.path())
LOG.info(_("Tempest plugin has been successfully installed!"))
def list_plugins(self):

View File

@ -46,7 +46,7 @@ EXPECTED_FAILURES = {
"This test fails because 'novnc' console type is unavailable."
}
TEMPEST_PLUGIN = "https://git.openstack.org/openstack/ceilometer"
TEMPEST_PLUGIN = "https://git.openstack.org/openstack/keystone"
# NOTE(andreykurilin): this variable is used to generate output file names
# with prefix ${CALL_COUNT}_ .

View File

@ -326,17 +326,23 @@ class TempestInstallAndUninstallTestCase(BaseTestCase):
@ddt.ddt
class TempestInstallPluginsTestCase(BaseTestCase):
@mock.patch("os.path.exists")
@mock.patch(TEMPEST_PATH + ".tempest.check_output")
@ddt.data("https://github.com/fake-plugin.git", "/tmp/fake-plugin")
def test_install_plugin(self, plugin_source, mock_tempest_check_output):
def test_install_plugin(self, plugin_source,
mock_tempest_check_output, mock_exists):
self.verifier.plugin_source = plugin_source
self.verifier.install_plugin()
cmd = [self.verifier.venv_wrapper, "pip", "install",
"--src", self.verifier.path("plugins"), "-e",
"git+{0}@master#egg={1}".format(plugin_source, "fake-plugin")]
mock_tempest_check_output.assert_called_with(cmd,
cwd=self.verifier.path())
cmd_1 = [self.verifier.venv_wrapper, "pip", "install",
"--src", self.verifier.path("plugins"), "-e",
"git+{0}@master#egg={1}".format(plugin_source, "fake-plugin")]
cmd_2 = [
self.verifier.venv_wrapper, "pip", "install", "-r",
self.verifier.path("plugins/fake-plugin/test-requirements.txt")]
mock_tempest_check_output.assert_has_calls([
mock.call(cmd_1, cwd=self.verifier.path()),
mock.call(cmd_2, cwd=self.verifier.path())])
@mock.patch(TEMPEST_PATH + ".tempest.check_output")
def test_list_plugins(self, mock_tempest_check_output):