
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
60 lines
2.2 KiB
Python
60 lines
2.2 KiB
Python
# Copyright 2014: 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.
|
|
|
|
import mock
|
|
|
|
from rally.benchmark.scenarios.tempest import tempest
|
|
from rally.benchmark.scenarios.tempest import utils
|
|
from tests import test
|
|
|
|
TS = "rally.benchmark.scenarios.tempest"
|
|
|
|
|
|
class TempestLogWrappersTestCase(test.TestCase):
|
|
|
|
def setUp(self):
|
|
super(TempestLogWrappersTestCase, self).setUp()
|
|
verifier = mock.MagicMock()
|
|
verifier.parse_results.return_value = ({"fake": True},
|
|
{"have_results": True})
|
|
|
|
context = {"tmp_results_dir": "/tmp/dir", "verifier": verifier}
|
|
self.scenario = tempest.TempestScenario(context)
|
|
self.scenario._add_atomic_actions = mock.MagicMock()
|
|
|
|
@mock.patch(TS + ".utils.tempfile")
|
|
def test_launch_without_specified_log_file(self, mock_tmp):
|
|
mock_tmp.NamedTemporaryFile().name = "tmp_file"
|
|
target_func = mock.MagicMock()
|
|
target_func.__name__ = "target_func"
|
|
func = utils.tempest_log_wrapper(target_func)
|
|
|
|
func(self.scenario)
|
|
|
|
target_func.assert_called_once_with(self.scenario,
|
|
log_file="/tmp/dir/tmp_file")
|
|
|
|
@mock.patch(TS + ".utils.tempfile")
|
|
def test_launch_with_specified_log_file(self, mock_tmp):
|
|
target_func = mock.MagicMock()
|
|
target_func.__name__ = "target_func"
|
|
func = utils.tempest_log_wrapper(target_func)
|
|
|
|
func(self.scenario, log_file='log_file')
|
|
|
|
target_func.assert_called_once_with(self.scenario,
|
|
log_file="log_file")
|
|
self.assertEqual(0, mock_tmp.NamedTemporaryFile.call_count)
|