From 0d71973551b55592280f8f8dcf666117ab975628 Mon Sep 17 00:00:00 2001 From: Boris Pavlovic Date: Sun, 1 Mar 2015 03:36:36 +0300 Subject: [PATCH] Switch to plugin base: context, sla, runners This patch attempts to switch to plugin base and unify context sla and runners plugins. *) Context, Runners, and SLA inherit Plugin class *) Remove Context, Runners and SLA implementations of plugin methods *) Use Meta for Context order and hidden options *) Fix rally-info to use new kind of plugins Change-Id: I5f13e07fa4d3048f86e7d7ef0ee39f9701463838 --- rally/consts.py | 8 -------- tests/unit/fakes.py | 3 ++- .../plugins/openstack/context/vm/test_custom_image.py | 4 +++- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/rally/consts.py b/rally/consts.py index abfaa388..cfd848c1 100644 --- a/rally/consts.py +++ b/rally/consts.py @@ -82,13 +82,6 @@ class _EndpointType(utils.ImmutableMixin, utils.EnumMixin): PUBLIC = "public" -class _RunnerType(utils.ImmutableMixin, utils.EnumMixin): - SERIAL = "serial" - CONSTANT = "constant" - CONSTANT_FOR_DURATION = "constant_for_duration" - RPS = "rps" - - class _Service(utils.ImmutableMixin, utils.EnumMixin): """OpenStack services names, by rally convention.""" @@ -171,7 +164,6 @@ class _ServiceType(utils.ImmutableMixin, utils.EnumMixin): TaskStatus = _TaskStatus() DeployStatus = _DeployStatus() EndpointPermission = _EndpointPermission() -RunnerType = _RunnerType() ServiceType = _ServiceType() Service = _Service() EndpointType = _EndpointType() diff --git a/tests/unit/fakes.py b/tests/unit/fakes.py index 6fcad5e5..779eebbe 100644 --- a/tests/unit/fakes.py +++ b/tests/unit/fakes.py @@ -1498,7 +1498,7 @@ class FakeTimer(rally_utils.Timer): return 0 -@context.context("fake", order=1) +@context.context(name="fake", order=1) class FakeContext(context.Context): CONFIG_SCHEMA = { @@ -1519,6 +1519,7 @@ class FakeContext(context.Context): pass +@context.context(name="fake_user_context", order=1) class FakeUserContext(FakeContext): admin = { diff --git a/tests/unit/plugins/openstack/context/vm/test_custom_image.py b/tests/unit/plugins/openstack/context/vm/test_custom_image.py index e57cc18c..1dec3ba9 100644 --- a/tests/unit/plugins/openstack/context/vm/test_custom_image.py +++ b/tests/unit/plugins/openstack/context/vm/test_custom_image.py @@ -17,6 +17,7 @@ import mock +from rally.benchmark import context from rally.plugins.openstack.context.vm import custom_image from tests.unit import test @@ -24,6 +25,7 @@ from tests.unit import test BASE = "rally.plugins.openstack.context.vm.custom_image" +@context.context(name="test_custom_image", order=500) class TestImageGenerator(custom_image.BaseCustomImageGenerator): def _customize_image(self, *args): pass @@ -37,7 +39,7 @@ class BaseCustomImageContextVMTestCase(test.TestCase): self.context = { "task": mock.MagicMock(), "config": { - "custom_image": { + "test_custom_image": { "image": {"name": "image"}, "flavor": {"name": "flavor"}, "username": "fedora",