From 1e04dbb628f3bdd2568eb0d1306688db7c0ec715 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 23 Nov 2015 11:17:33 -0600 Subject: [PATCH] Remove old generate_random_name() use from sahara context Change-Id: Ic83e0b24a41fe718bb4f1e93acb954ac583c5eee --- .../context/sahara/sahara_output_data_sources.py | 3 +-- .../context/sahara/test_sahara_output_data_sources.py | 11 ++++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/rally/plugins/openstack/context/sahara/sahara_output_data_sources.py b/rally/plugins/openstack/context/sahara/sahara_output_data_sources.py index 714112f4..76ed260f 100644 --- a/rally/plugins/openstack/context/sahara/sahara_output_data_sources.py +++ b/rally/plugins/openstack/context/sahara/sahara_output_data_sources.py @@ -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), diff --git a/tests/unit/plugins/openstack/context/sahara/test_sahara_output_data_sources.py b/tests/unit/plugins/openstack/context/sahara/test_sahara_output_data_sources.py index 544b5741..d6a1c3be 100644 --- a/tests/unit/plugins/openstack/context/sahara/test_sahara_output_data_sources.py +++ b/tests/unit/plugins/openstack/context/sahara/test_sahara_output_data_sources.py @@ -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" ))