
Here we add a new "rally info" command, which, based on the input, prints descriptions for different entities in Rally (in this patch - benchmark scenarios & scenario groups, more entities are to follow (deployment engines etc.)). This command makes use of docstrings by parsing them and printing them in CLI in human-readable form. The command should be called as "rally info find <query>" (or, in case of an explicit parameter setting, "rally info find --query=<query>"). Samples: $ rally info find create_meter_and_get_stats CeilometerStats.create_meter_and_get_stats (benchmark scenario). Test creating a meter and fetching its statistics. Meter is first created and then statistics is fetched for the same using GET /v2/meters/(meter_name)/statistics. Parameters: - name_length: length of generated (random) part of meter name - kwargs: contains optional arguments to create a meter $ rally info find Authenticate Authenticate (benchmark scenario group). This class should contain authentication mechanism. For different types of clients like Keystone. Change-Id: Icf3545c0666d99ab7fd0eaabce8bbe572834e485
55 lines
2.0 KiB
Python
55 lines
2.0 KiB
Python
# Copyright 2013: 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.
|
|
|
|
"""Test for Rally search utils."""
|
|
|
|
from rally.benchmark.scenarios.dummy import dummy
|
|
from rally import searchutils
|
|
from tests import test
|
|
|
|
|
|
class FindBenchmarkScenarioGroupTestCase(test.TestCase):
|
|
|
|
def test_find_success(self):
|
|
scenario_group = searchutils.find_benchmark_scenario_group("Dummy")
|
|
self.assertEqual(scenario_group, dummy.Dummy)
|
|
|
|
def test_find_failure(self):
|
|
scenario_group = searchutils.find_benchmark_scenario_group("Dumy")
|
|
self.assertEqual(scenario_group, None)
|
|
|
|
|
|
class FindBenchmarkScenarioTestCase(test.TestCase):
|
|
|
|
def test_find_success_full_path(self):
|
|
scenario_method = searchutils.find_benchmark_scenario("Dummy.dummy")
|
|
self.assertEqual(scenario_method, dummy.Dummy.dummy)
|
|
|
|
def test_find_success_shortened_path(self):
|
|
scenario_method = searchutils.find_benchmark_scenario("dummy")
|
|
self.assertEqual(scenario_method, dummy.Dummy.dummy)
|
|
|
|
def test_find_failure_bad_shortening(self):
|
|
scenario_method = searchutils.find_benchmark_scenario("dumy")
|
|
self.assertEqual(scenario_method, None)
|
|
|
|
def test_find_failure_bad_group_name(self):
|
|
scenario_method = searchutils.find_benchmark_scenario("Dumy.dummy")
|
|
self.assertEqual(scenario_method, None)
|
|
|
|
def test_find_failure_bad_scenario_name(self):
|
|
scenario_method = searchutils.find_benchmark_scenario("Dummy.dumy")
|
|
self.assertEqual(scenario_method, None)
|