Fix loading plugins in tests and CI

Removing OpenStack related plugins for rally framework repo
made osresources script to fail while calling osclients. The same is
true for unittests.

Let's skip some jobs in our CI to speed up merging of the fix to do not
waste nerves of other teams.

Change-Id: Ifbdd7792f04dde63fa6aaca9302acaf719b63fcc
This commit is contained in:
Andrey Kurilin 2018-06-21 12:09:38 +03:00
parent 0101e8a7c1
commit 20f978382a
5 changed files with 14 additions and 57 deletions

View File

@ -36,46 +36,6 @@
- rally-tox-py35
- rally-docker-check
- rally-task-simple-job
- rally-task-basic-with-existing-users:
# use_existing_users key did not trigger proper ansible tasks
voting: false
# NOTE(andreykurilin): this requires more thing to configure before
# launching.
#- rally-task-designate
- rally-task-heat
- rally-task-ironic
- rally-task-keystone-glance-swift
- rally-task-load-balancing:
voting: false
- rally-task-magnum:
voting: false
files:
- rally-jobs/magnum.yaml
- rally_openstack/cleanup/resources.py
- rally_openstack/contexts/magnum
- rally_openstack/scenarios/magnum
- rally_openstack/osclients.py
# NOTE(andreykurilin): manila requires some specific configuration.
# Calling special hook can help.
# https://github.com/openstack/manila/blob/master/playbooks/legacy/rally-dsvm-manila-multibackend/run.yaml
#- rally-task-manila
#- rally-task-manila-no-ss
- rally-task-mistral
# it did not work for a long time. try to re-configure it
#- rally-task-monasca
- rally-task-murano
- rally-task-neutron
- rally-task-neutron-with-extensions:
voting: false
- rally-task-nova:
voting: false
# it did not work for a long time
#- rally-task-senlin
- rally-task-telemetry
- rally-task-watcher:
# watcher-api did not start last time
voting: false
- rally-task-zaqar
gate:
jobs:
- rally-tox-pep8
@ -83,11 +43,3 @@
- rally-tox-py35
- rally-docker-check
- rally-task-simple-job
- rally-task-heat
- rally-task-ironic
- rally-task-keystone-glance-swift
- rally-task-mistral
- rally-task-murano
- rally-task-neutron
- rally-task-telemetry
- rally-task-zaqar

View File

@ -24,6 +24,7 @@ import sys
from rally.cli import cliutils
from rally.common.plugin import discover
from rally import plugins
import six
from rally_openstack import consts
@ -514,6 +515,7 @@ def _print_tabular_resources(resources, table_label):
print("")
@plugins.ensure_plugins_are_loaded
def main():
parser = argparse.ArgumentParser(

View File

@ -26,6 +26,9 @@ from rally import plugins
from tests.unit import fakes
plugins.load()
class DatabaseFixture(cfg.fixture.Config):
"""Create clean DB before starting test."""
def setUp(self):
@ -43,7 +46,6 @@ class TestCase(base.BaseTestCase):
def setUp(self):
super(TestCase, self).setUp()
self.addCleanup(mock.patch.stopall)
plugins.load()
def _test_atomic_action_timer(self, atomic_actions, name, count=1,
parent=[]):

View File

@ -18,7 +18,6 @@ import mock
from rally.common import cfg
from rally import exceptions
from rally import osclients as deprecated_osclients # noqa
from rally_openstack import consts
from rally_openstack import credential as oscredential

View File

@ -16,10 +16,12 @@
import sys
from rally.plugins.workload import siege
import mock
from rally_openstack.workload import siege
from tests.unit import test
import mock
SIEGE_OUTPUT = """
Transactions: 522 hits
@ -50,15 +52,15 @@ OUTPUT = [
class SiegeTestCase(test.TestCase):
@mock.patch("rally.plugins.workload.siege.json.load")
@mock.patch("rally_openstack.workload.siege.json.load")
def test_get_instances(self, mock_load):
mock_load.return_value = OUTPUT
instances = list(siege.get_instances())
self.assertEqual(["10.0.0.4", "10.0.0.5"], instances)
@mock.patch("rally.plugins.workload.siege.get_instances")
@mock.patch("rally.plugins.workload.siege.generate_urls_list")
@mock.patch("rally.plugins.workload.siege.subprocess.check_output")
@mock.patch("rally_openstack.workload.siege.get_instances")
@mock.patch("rally_openstack.workload.siege.generate_urls_list")
@mock.patch("rally_openstack.workload.siege.subprocess.check_output")
def test_run(self, mock_check_output, mock_generate_urls_list,
mock_get_instances):
mock_get_instances.return_value = [1, 2]
@ -74,7 +76,7 @@ class SiegeTestCase(test.TestCase):
sys.stdout = real_stdout
self.assertEqual(expected, mock_write.mock_calls)
@mock.patch("rally.plugins.workload.siege.tempfile.NamedTemporaryFile")
@mock.patch("rally_openstack.workload.siege.tempfile.NamedTemporaryFile")
def test_generate_urls_list(self, mock_named_temporary_file):
mock_urls = mock.MagicMock()
mock_named_temporary_file.return_value = mock_urls