Fixes InvalidBenchmarkConfig error while running tempest scenario

Change-Id: Id7d0fce04e978a684bc87fb3297b2010d8361972
Closes-Bug: #1372784
This commit is contained in:
Alexander Maretskiy 2014-09-25 19:14:06 +03:00
parent cb5c679cc6
commit 61dfb24c5f
2 changed files with 14 additions and 7 deletions

View File

@ -294,8 +294,7 @@ def tempest_tests_exists(config, clients, task):
return ValidationResult(False,
"Parameter 'test_name' or 'test_names' should "
"be specified.")
verifier = tempest.Tempest(task.deployment_uuid)
verifier = tempest.Tempest(task["deployment_uuid"])
if not verifier.is_installed():
verifier.install()
if not verifier.is_configured():

View File

@ -20,6 +20,7 @@ from novaclient import exceptions as nova_exc
from rally.benchmark import validation
from rally import consts
from rally import exceptions
from rally import objects
from tests import test
@ -291,15 +292,22 @@ class ValidatorsTestCase(test.TestCase):
self.assertFalse(result.is_valid, result.msg)
@mock.patch("rally.benchmark.validation.tempest.Tempest")
def test_tempest_tests_exists(self, mock_tempest):
task = mock.MagicMock()
task.deployment_uuid = "uuid"
@mock.patch("rally.objects.task.db.task_create")
def test_tempest_tests_exists(self, mock_create, mock_tempest):
mock_create.return_value = {
'status': 'init',
'deployment_uuid': 'deployment-uuid',
'verification_log': '',
'uuid': 'task-uuid',
'created_at': '',
'failed': False,
'tag': '',
'id': 42}
mock_tempest().is_installed.return_value = False
mock_tempest().is_configured.return_value = False
mock_tempest().discover_tests.return_value = set([
"tempest.api.a", "tempest.api.b", "tempest.api.c"])
task = objects.Task(deployment_uuid='deployment-uuid')
validator = self._unwrap_validator(validation.tempest_tests_exists)
result = validator({"args": {"test_name": "a"}}, None, task)