Merge "Require member role in the static get_primary_creds" into mcp/caracal
diff --git a/tempest/lib/common/preprov_creds.py b/tempest/lib/common/preprov_creds.py
index 6d948cf..95fb346 100644
--- a/tempest/lib/common/preprov_creds.py
+++ b/tempest/lib/common/preprov_creds.py
@@ -312,7 +312,8 @@
def get_primary_creds(self):
if self._creds.get('primary'):
return self._creds.get('primary')
- net_creds = self._get_creds()
+ # NOTE(pas-ha) use the same call as get_project_member_creds
+ net_creds = self._get_creds(['member'], scope='project')
self._creds['primary'] = net_creds
return net_creds
diff --git a/tempest/tests/lib/common/test_preprov_creds.py b/tempest/tests/lib/common/test_preprov_creds.py
index f2131dc..f6d3778 100644
--- a/tempest/tests/lib/common/test_preprov_creds.py
+++ b/tempest/tests/lib/common/test_preprov_creds.py
@@ -77,7 +77,10 @@
{'username': 'test_admin2', 'project_name': 'test_tenant12',
'password': 'p', 'roles': [admin_role]},
{'username': 'test_admin3', 'project_name': 'test_tenant13',
- 'password': 'p', 'types': ['admin']}]
+ 'password': 'p', 'types': ['admin']},
+ {'username': 'test_user14', 'project_name': 'test_tenant14',
+ 'password': 'p', 'roles': ['member']},
+ ]
def setUp(self):
super(TestPreProvisionedCredentials, self).setUp()
@@ -319,7 +322,7 @@
calls = get_free_hash_mock.mock.mock_calls
self.assertEqual(len(calls), 1)
args = calls[0][1][0]
- self.assertEqual(len(args), 10)
+ self.assertEqual(len(args), 11)
for i in admin_hashes:
self.assertNotIn(i, args)
@@ -480,4 +483,8 @@
{'username': 'test_admin2', 'project_name': 'test_project12',
'domain_name': 'domain', 'password': 'p', 'roles': [admin_role]},
{'username': 'test_admin3', 'project_name': 'test_tenant13',
- 'domain_name': 'domain', 'password': 'p', 'types': ['admin']}]
+ 'domain_name': 'domain', 'password': 'p', 'types': ['admin']},
+ {'username': 'test_user14', 'project_name': 'test_tenant14',
+ 'domain_name': 'domain', 'password': 'p',
+ 'roles': ['member']},
+ ]