Merge "Split validation at 3 layers"

This commit is contained in:
Jenkins 2017-04-20 14:21:48 +00:00 committed by Gerrit Code Review
commit 8cf9e22e28
3 changed files with 6 additions and 10 deletions

View File

@ -30,6 +30,7 @@ from rally.plugins.openstack.services.identity import identity
from rally.plugins.openstack.wrappers import network
from rally.task import context
from rally.task import utils
from rally.task import validation
from rally.common import opts
opts.register()
@ -45,6 +46,7 @@ PROJECT_DOMAIN_DESCR = "ID of domain in which projects will be created."
USER_DOMAIN_DESCR = "ID of domain in which users will be created."
@validation.add("required_platform", platform="openstack", admin=True)
@context.configure(name="users", namespace="openstack", order=100)
class UserGenerator(context.Context):
"""Context class for generating temporary users/tenants for benchmarks."""

View File

@ -40,10 +40,7 @@ class TaskSampleTestCase(test.TestCase):
if os.environ.get("TOX_ENV_NAME") == "cover":
self.skipTest("There is no need to check samples in coverage job.")
@mock.patch("rally.task.engine.TaskEngine"
"._validate_config_semantic")
def test_schema_is_valid(self,
mock_task_engine__validate_config_semantic):
def test_schema_is_valid(self):
scenarios = set()
for dirname, dirnames, filenames in os.walk(self.samples_path):
@ -61,7 +58,7 @@ class TaskSampleTestCase(test.TestCase):
(task_file.read()))
eng = engine.TaskEngine(task_config,
mock.MagicMock(), mock.Mock())
eng.validate()
eng.validate(only_syntax=True)
except Exception:
print(traceback.format_exc())
self.fail("Invalid task file: %s" % full_path)

View File

@ -29,10 +29,7 @@ class RallyJobsTestCase(test.TestCase):
rally_jobs_path = os.path.join(
os.path.dirname(rally.__file__), "..", "rally-jobs")
@mock.patch("rally.task.engine.TaskEngine"
"._validate_config_semantic")
def test_schema_is_valid(
self, mock_task_engine__validate_config_semantic):
def test_schema_is_valid(self):
discover.load_plugins(os.path.join(self.rally_jobs_path, "plugins"))
files = {f for f in os.listdir(self.rally_jobs_path)
@ -64,7 +61,7 @@ class RallyJobsTestCase(test.TestCase):
eng = engine.TaskEngine(task, mock.MagicMock(),
mock.Mock())
eng.validate()
eng.validate(only_syntax=True)
except Exception:
print(traceback.format_exc())
self.fail("Wrong task input file: %s" % full_path)