Sets new users' endpoint_type to default to admin's
Previously users created by the Users context set by default the endpoint_type to consts.EndpointType.PUBLIC, but if const.EndpointType.INTERNAL was specified only it'd have applied to admin and existing users. This patch sets the endpoint_type to default to the admin's endpoint_type. Change-Id: I0618abbf42ecfc5cdaf9a3807b1002408bca9325 Closes-Bug: 1424082
This commit is contained in:
parent
48cf7baa1f
commit
2b738e9541
@ -186,7 +186,8 @@ class UserGenerator(base.Context):
|
||||
client.auth_url, user.name, password,
|
||||
self.context["tenants"][tenant_id]["name"],
|
||||
consts.EndpointPermission.USER, client.region_name,
|
||||
project_domain_name=project_dom, user_domain_name=user_dom)
|
||||
project_domain_name=project_dom, user_domain_name=user_dom,
|
||||
endpoint_type=self.endpoint.endpoint_type)
|
||||
users.append({"id": user.id,
|
||||
"endpoint": user_endpoint,
|
||||
"tenant_id": tenant_id})
|
||||
|
@ -16,7 +16,9 @@
|
||||
import mock
|
||||
|
||||
from rally.benchmark.context import users
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally import objects
|
||||
from tests.unit import test
|
||||
|
||||
|
||||
@ -235,3 +237,46 @@ class UserGeneratorTestCase(test.TestCase):
|
||||
tenants_ids, user_list):
|
||||
self.assertEqual(user["id"], orig_user.id)
|
||||
self.assertEqual(user["tenant_id"], tenant_id)
|
||||
|
||||
@mock.patch("rally.benchmark.context.users.keystone")
|
||||
def test_users_contains_correct_endpoint_type(self, mock_keystone):
|
||||
endpoint = objects.Endpoint("foo_url", "foo", "foo_pass",
|
||||
endpoint_type=consts.EndpointType.INTERNAL)
|
||||
config = {
|
||||
"config": {
|
||||
"users": {
|
||||
"tenants": 1,
|
||||
"users_per_tenant": 2,
|
||||
"resource_management_workers": 1
|
||||
}
|
||||
},
|
||||
"admin": {"endpoint": endpoint},
|
||||
"task": {"uuid": "task_id"}
|
||||
}
|
||||
|
||||
user_generator = users.UserGenerator(config)
|
||||
users_ = user_generator._create_users()
|
||||
|
||||
for user in users_:
|
||||
self.assertEqual("internal", user["endpoint"].endpoint_type)
|
||||
|
||||
@mock.patch("rally.benchmark.context.users.keystone")
|
||||
def test_users_contains_default_endpoint_type(self, mock_keystone):
|
||||
endpoint = objects.Endpoint("foo_url", "foo", "foo_pass")
|
||||
config = {
|
||||
"config": {
|
||||
"users": {
|
||||
"tenants": 1,
|
||||
"users_per_tenant": 2,
|
||||
"resource_management_workers": 1
|
||||
}
|
||||
},
|
||||
"admin": {"endpoint": endpoint},
|
||||
"task": {"uuid": "task_id"}
|
||||
}
|
||||
|
||||
user_generator = users.UserGenerator(config)
|
||||
users_ = user_generator._create_users()
|
||||
|
||||
for user in users_:
|
||||
self.assertEqual("public", user["endpoint"].endpoint_type)
|
||||
|
Loading…
x
Reference in New Issue
Block a user