diff --git a/rally/plugins/openstack/scenarios/keystone/basic.py b/rally/plugins/openstack/scenarios/keystone/basic.py index e7e7d419..7dab7ce2 100644 --- a/rally/plugins/openstack/scenarios/keystone/basic.py +++ b/rally/plugins/openstack/scenarios/keystone/basic.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +from rally.common import utils from rally.plugins.openstack.scenarios.keystone import utils as kutils from rally.task.scenarios import base from rally.task import validation @@ -155,16 +156,18 @@ class KeystoneBasic(kutils.KeystoneScenario): self._get_service(service.id) @validation.required_openstack(admin=True) + @utils.log_deprecated_args( + "The 'name' argument to create_and_delete_service will be ignored", + "0.0.5", ["name"]) @base.scenario(context={"admin_cleanup": ["keystone"]}) def create_and_delete_service(self, name=None, service_type=None, description=None): """Create and delete service. - :param name: name of the service :param service_type: type of the service :param description: description of the service """ - service = self._service_create(name, service_type, description) + service = self._service_create(service_type, description) self._delete_service(service.id) @validation.number("name_length", minval=10) @@ -195,16 +198,18 @@ class KeystoneBasic(kutils.KeystoneScenario): self._update_user_password(user.id, password) @validation.required_openstack(admin=True) + @utils.log_deprecated_args( + "The 'name' argument to create_and_list_services will be ignored", + "0.0.5", ["name"]) @base.scenario(context={"admin_cleanup": ["keystone"]}) def create_and_list_services(self, name=None, service_type=None, description=None): """Create and list services. - :param name: name of the service :param service_type: type of the service :param description: description of the service """ - self._service_create(name, service_type, description) + self._service_create(service_type, description) self._list_services() @validation.required_openstack(users=True) diff --git a/rally/plugins/openstack/scenarios/keystone/utils.py b/rally/plugins/openstack/scenarios/keystone/utils.py index 2f01799c..56ee0a54 100644 --- a/rally/plugins/openstack/scenarios/keystone/utils.py +++ b/rally/plugins/openstack/scenarios/keystone/utils.py @@ -63,7 +63,7 @@ class KeystoneScenario(base.Scenario): return self.admin_clients("keystone").tenants.create(name, **kwargs) @base.atomic_action_timer("keystone.create_service") - def _service_create(self, name=None, service_type="rally_test_type", + def _service_create(self, service_type="rally_test_type", description=None): """Creates keystone service with random name. @@ -72,12 +72,11 @@ class KeystoneScenario(base.Scenario): :param description: description of the service :returns: keystone service instance """ - name = name or self._generate_random_name(prefix="rally_test_service_") description = description or self._generate_random_name( prefix="rally_test_service_description_") - return self.admin_clients("keystone").services.create(name, - service_type, - description) + return self.admin_clients("keystone").services.create( + self._generate_random_name(), + service_type, description) @base.atomic_action_timer("keystone.create_users") def _users_create(self, tenant, users_per_tenant, name_length=10): diff --git a/samples/tasks/scenarios/keystone/create-and-delete-service.json b/samples/tasks/scenarios/keystone/create-and-delete-service.json index ce649e33..b07e2208 100644 --- a/samples/tasks/scenarios/keystone/create-and-delete-service.json +++ b/samples/tasks/scenarios/keystone/create-and-delete-service.json @@ -2,8 +2,7 @@ "KeystoneBasic.create_and_delete_service": [ { "args": { - "name": "Rally_test_service", - "service_type": "Really_test_type", + "service_type": "Rally_test_type", "description": "test_description" }, "runner": { diff --git a/samples/tasks/scenarios/keystone/create-and-delete-service.yaml b/samples/tasks/scenarios/keystone/create-and-delete-service.yaml index a1895262..9535fb7d 100644 --- a/samples/tasks/scenarios/keystone/create-and-delete-service.yaml +++ b/samples/tasks/scenarios/keystone/create-and-delete-service.yaml @@ -2,8 +2,7 @@ KeystoneBasic.create_and_delete_service: - args: - name: "Rally_test_service" - service_type: "Really_test_type" + service_type: "Rally_test_type" description: "test_description" runner: type: "constant" diff --git a/samples/tasks/scenarios/keystone/create-and-list-services.json b/samples/tasks/scenarios/keystone/create-and-list-services.json index b32abfc9..f8fe5178 100644 --- a/samples/tasks/scenarios/keystone/create-and-list-services.json +++ b/samples/tasks/scenarios/keystone/create-and-list-services.json @@ -2,8 +2,7 @@ "KeystoneBasic.create_and_list_services": [ { "args": { - "name": "Rally_test_service", - "service_type": "Really_test_type", + "service_type": "Rally_test_type", "description": "test_description" }, "runner": { diff --git a/samples/tasks/scenarios/keystone/create-and-list-services.yaml b/samples/tasks/scenarios/keystone/create-and-list-services.yaml index b7d9514a..76ac4d46 100644 --- a/samples/tasks/scenarios/keystone/create-and-list-services.yaml +++ b/samples/tasks/scenarios/keystone/create-and-list-services.yaml @@ -2,8 +2,7 @@ KeystoneBasic.create_and_list_services: - args: - name: "Rally_test_service" - service_type: "Really_test_type" + service_type: "Rally_test_type" description: "test_description" runner: type: "constant" diff --git a/tests/unit/plugins/openstack/scenarios/keystone/test_basic.py b/tests/unit/plugins/openstack/scenarios/keystone/test_basic.py index 5d65273f..712a7ab8 100644 --- a/tests/unit/plugins/openstack/scenarios/keystone/test_basic.py +++ b/tests/unit/plugins/openstack/scenarios/keystone/test_basic.py @@ -194,17 +194,14 @@ class KeystoneBasicTestCase(test.TestCase): def test_create_and_delete_service(self): scenario = basic.KeystoneBasic() - name = "Rally_test_service" - service_type = "rally_test_type" + service_type = "test_service_type" description = "test_description" fake_service = mock.MagicMock() scenario._service_create = mock.MagicMock(return_value=fake_service) scenario._delete_service = mock.MagicMock() - scenario.create_and_delete_service(name=name, - service_type=service_type, + scenario.create_and_delete_service(service_type=service_type, description=description) - scenario._service_create.assert_called_once_with(name, - service_type, + scenario._service_create.assert_called_once_with(service_type, description) scenario._delete_service.assert_called_once_with(fake_service.id) @@ -235,17 +232,14 @@ class KeystoneBasicTestCase(test.TestCase): def test_create_and_list_services(self): scenario = basic.KeystoneBasic() - name = "Rally_test_service" - service_type = "rally_test_type" + service_type = "test_service_type" description = "test_description" fake_service = mock.MagicMock() scenario._service_create = mock.MagicMock(return_value=fake_service) scenario._list_services = mock.MagicMock() - scenario.create_and_list_services(name=name, - service_type=service_type, + scenario.create_and_list_services(service_type=service_type, description=description) - scenario._service_create.assert_called_once_with(name, - service_type, + scenario._service_create.assert_called_once_with(service_type, description) scenario._list_services.assert_called_once_with() diff --git a/tests/unit/plugins/openstack/scenarios/keystone/test_utils.py b/tests/unit/plugins/openstack/scenarios/keystone/test_utils.py index 707d2f5e..f0c0de16 100644 --- a/tests/unit/plugins/openstack/scenarios/keystone/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/keystone/test_utils.py @@ -142,21 +142,21 @@ class KeystoneScenarioTestCase(test.ScenarioTestCase): "keystone.create_tenant") def test_service_create(self): - name = "abc" - service_type = name + "_service_type" - description = name + "_description" + service_type = "service_type" + description = "_description" scenario = utils.KeystoneScenario() + scenario._generate_random_name = mock.Mock() - result = scenario._service_create(name=name, - service_type=service_type, + result = scenario._service_create(service_type=service_type, description=description) self.assertEqual( self.admin_clients("keystone").services.create.return_value, result) self.admin_clients("keystone").services.create.assert_called_once_with( - name, service_type, description) + scenario._generate_random_name.return_value, + service_type, description) self._test_atomic_action_timer(scenario.atomic_actions(), "keystone.create_service")