Merge "Add functional test for --plugin-paths parameter"
This commit is contained in:
commit
0c267c8168
25
tests/functional/extra/fake_dir1/fake_plugin1.py
Normal file
25
tests/functional/extra/fake_dir1/fake_plugin1.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Copyright 2015: Mirantis Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from rally.benchmark.scenarios import base
|
||||||
|
|
||||||
|
|
||||||
|
class FakeScenarioPlugin1(base.Scenario):
|
||||||
|
"""Sample fake plugin."""
|
||||||
|
|
||||||
|
@base.scenario()
|
||||||
|
def list(self):
|
||||||
|
"""Fake scenario."""
|
||||||
|
pass
|
25
tests/functional/extra/fake_dir2/fake_plugin2.py
Normal file
25
tests/functional/extra/fake_dir2/fake_plugin2.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Copyright 2015: Mirantis Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from rally.benchmark.scenarios import base
|
||||||
|
|
||||||
|
|
||||||
|
class FakeScenarioPlugin2(base.Scenario):
|
||||||
|
"""Sample fake plugin."""
|
||||||
|
|
||||||
|
@base.scenario()
|
||||||
|
def list(self):
|
||||||
|
"""Fake scenario."""
|
||||||
|
pass
|
18
tests/functional/extra/test_fake_scenario.json
Normal file
18
tests/functional/extra/test_fake_scenario.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"FakeScenarioPlugin1.list": [
|
||||||
|
{
|
||||||
|
"runner": {
|
||||||
|
"type": "constant",
|
||||||
|
"times": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"FakeScenarioPlugin2.list": [
|
||||||
|
{
|
||||||
|
"runner": {
|
||||||
|
"type": "constant",
|
||||||
|
"times": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -301,6 +301,42 @@ class TaskTestCase(unittest.TestCase):
|
|||||||
r"(?P<task_id>[0-9a-f\-]{36}): started", output)
|
r"(?P<task_id>[0-9a-f\-]{36}): started", output)
|
||||||
self.assertIsNotNone(result)
|
self.assertIsNotNone(result)
|
||||||
|
|
||||||
|
def test_validate_with_plugin_paths(self):
|
||||||
|
rally = utils.Rally()
|
||||||
|
with mock.patch.dict("os.environ", utils.TEST_ENV):
|
||||||
|
plugin_paths = ("tests/functional/extra/fake_dir1/,"
|
||||||
|
"tests/functional/extra/fake_dir2/")
|
||||||
|
task_file = "tests/functional/extra/test_fake_scenario.json"
|
||||||
|
output = rally(("--plugin-paths %(plugin_paths)s "
|
||||||
|
"task validate --task %(task_file)s") %
|
||||||
|
{"task_file": task_file,
|
||||||
|
"plugin_paths": plugin_paths})
|
||||||
|
|
||||||
|
self.assertIn("Task config is valid", output)
|
||||||
|
|
||||||
|
plugin_paths = ("tests/functional/extra/fake_dir1/"
|
||||||
|
"fake_plugin1.py,"
|
||||||
|
"tests/functional/extra/fake_dir2/"
|
||||||
|
"fake_plugin2.py")
|
||||||
|
task_file = "tests/functional/extra/test_fake_scenario.json"
|
||||||
|
output = rally(("--plugin-paths %(plugin_paths)s "
|
||||||
|
"task validate --task %(task_file)s") %
|
||||||
|
{"task_file": task_file,
|
||||||
|
"plugin_paths": plugin_paths})
|
||||||
|
|
||||||
|
self.assertIn("Task config is valid", output)
|
||||||
|
|
||||||
|
plugin_paths = ("tests/functional/extra/fake_dir1/,"
|
||||||
|
"tests/functional/extra/fake_dir2/"
|
||||||
|
"fake_plugin2.py")
|
||||||
|
task_file = "tests/functional/extra/test_fake_scenario.json"
|
||||||
|
output = rally(("--plugin-paths %(plugin_paths)s "
|
||||||
|
"task validate --task %(task_file)s") %
|
||||||
|
{"task_file": task_file,
|
||||||
|
"plugin_paths": plugin_paths})
|
||||||
|
|
||||||
|
self.assertIn("Task config is valid", output)
|
||||||
|
|
||||||
def _test_start_abort_on_sla_failure_success(self, cfg, times):
|
def _test_start_abort_on_sla_failure_success(self, cfg, times):
|
||||||
rally = utils.Rally()
|
rally = utils.Rally()
|
||||||
with mock.patch.dict("os.environ", utils.TEST_ENV):
|
with mock.patch.dict("os.environ", utils.TEST_ENV):
|
||||||
|
Loading…
Reference in New Issue
Block a user