Merge "Remove old generate_random_name() use from sahara context"

This commit is contained in:
Jenkins 2015-11-26 05:56:55 +00:00 committed by Gerrit Code Review
commit dde6a8cfad
2 changed files with 5 additions and 9 deletions

View File

@ -60,8 +60,7 @@ class SaharaOutputDataSources(context.Context):
if self.config["output_type"] == "swift":
swift = swift_utils.SwiftScenario(clients=clients,
context=self.context)
container_name = rutils.generate_random_name(
prefix=self.config["output_url_prefix"])
container_name = self.generate_random_name()
self.context["tenants"][tenant_id]["sahara"]["container"] = {
"name": swift._create_container(
container_name=container_name),

View File

@ -106,11 +106,8 @@ class SaharaOutputDataSourcesTestCase(test.ScenarioTestCase):
names=["sahara.data_sources"],
users=self.context["users"])
@mock.patch("rally.common.utils.generate_random_name",
return_value="rally")
@mock.patch("%s.sahara_output_data_sources.osclients" % CTX)
def test_setup_inputs_swift(self, mock_osclients,
mock_generate_random_name):
def test_setup_inputs_swift(self, mock_osclients):
mock_sahara = mock_osclients.Clients(mock.MagicMock()).sahara()
self.context.update({
@ -132,15 +129,15 @@ class SaharaOutputDataSourcesTestCase(test.ScenarioTestCase):
sahara_ctx = sahara_output_data_sources.SaharaOutputDataSources(
self.context)
sahara_ctx.generate_random_name = mock.Mock()
sahara_ctx.generate_random_name = mock.Mock(return_value="random_name")
output_ds_crete_calls = []
for i in range(self.tenants_num):
output_ds_crete_calls.append(mock.call(
name=sahara_ctx.generate_random_name.return_value,
name="random_name",
description="",
data_source_type="swift",
url="swift://rally.sahara/",
url="swift://random_name.sahara/",
credential_user="user",
credential_pass="passwd"
))