rally/tests/rally_scenarios/test_scenarios.py
Kumar Rishabh d4a8ed80f8 Patched version of hacking library
updated version of hacking library for tests

Change-Id: I90dbded90f7bae03b9087c910ce542c2b3642da4
2014-07-09 10:06:45 +00:00

47 lines
1.7 KiB
Python

# 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.
import os
import traceback
import mock
import yaml
from rally.benchmark import engine
import rally.utils as rutils
from tests import test
class ScenarioTestCase(test.TestCase):
rally_scenarios_path = os.path.join(
os.path.dirname(__file__), "..", "..", "rally-scenarios")
@mock.patch("rally.benchmark.engine.BenchmarkEngine"
"._validate_config_semantic")
def test_schema_is_valid(self, mock_validate):
rutils.load_plugins(os.path.join(self.rally_scenarios_path, "plugins"))
for filename in ["rally.yaml", "rally-neutron.yaml"]:
full_path = os.path.join(self.rally_scenarios_path, filename)
with open(full_path) as task_file:
try:
task_config = yaml.safe_load(task_file.read())
eng = engine.BenchmarkEngine(task_config,
mock.MagicMock())
eng.validate()
except Exception:
print(traceback.format_exc())
self.fail("Wrong scenario config %s" % full_path)