[qa] dynamic credentials with the tempest swift client
Hello. I am developing GUI tests (Selenium) for the openstack director. I am now trying to make use of tempest Swift client in one of the tests which needs to fetch a file from the tripleo plans. I added this code in our base class to access the client: class GUITestCase(test.BaseTestCase): credentials = ('admin', 'primary') @classmethod def setup_clients(cls): super(GUITestCase, cls).setup_clients() # Clients for Swift cls.account_client = cls.os_admin.account_client cls.container_client = cls.os_admin.container_client cls.object_client = cls.os_admin.object_client I then try to list the objects in the "overcloud" container, which is where the default plans are found: class TestSwift(GUITestCase): def test_swift(self): (resp, body) = self.container_client.list_container_objects( "overcloud") print resp print body It returns a "not found" error. I'm pretty sure that the reason for it not finding the container (which is definitely there) is that it creates a project and a user for itself, and uses those credentials for its interactions with the undercloud. I can see the POST calls in tempest.log that show that it's creating itself the dynamic credentials: INFO tempest.lib.common.rest_client [req-54a... ] Request (TestSwift:setUpClass): 201 POST http://192.168.24.3:35357/v3/projects 0.365s INFO tempest.lib.common.rest_client [req-d3f... ] Request (TestSwift:setUpClass): 201 POST http://192.168.24.3:35357/v3/users 0.493s INFO tempest.lib.common.rest_client [req-480... ] Request (TestSwift:setUpClass): 200 GET http://192.168.24.3:35357/v3/roles 0.297s INFO tempest.lib.common.rest_client [req-e0a... ] Request (TestSwift:setUpClass): 204 PUT http://192.168.24.3:35357/v3/projects/9e1e6b33dcbd4aebb546c56a7258d5e0/users... 0.270s INFO tempest.lib.common.dynamic_creds [-] *Acquired dynamic creds:* credentials: Credentials: {'username': u'tempest-TestSwift-1494291785', 'project_name': u'tempest-TestSwift-1494291785', 'project_domain_id': u'default', 'user_domain_id': u'default', 'tenant_id': u'9e1e6b33dcbd4aebb546c56a7258d5e0', 'user_domain_name': u'Default', 'domain_name': u'Default', 'tenant_name': u'tempest-TestSwift-1494291785', 'user_id': u'cc715537a0c048b7a8692a0c8304b94d', 'project_id': u'9e1e6b33dcbd4aebb546c56a7258d5e0', 'domain_id': u'default', 'project_domain_name': u'Default'}, Network: None, Subnet: None, Router: None So I'm looking for a way to utilize the client without it automatically creating itself dynamic credentials; it has to use the already-existing admin credentials on the admin project in order to see the container with the plans. What's the right way to do that, please? Thanks a lot in advance! Regards, Udi Kalifon; Senior QE; RHOS-UI Automation
Hi, On Thu, Jan 17, 2019, at 17:58, Udi Kalifon wrote: :
So I'm looking for a way to utilize the client without it automatically creating itself dynamic credentials; it has to use the already-existing admin credentials on the admin project in order to see the container with the plans. What's the right way to do that, please? Thanks a lot in advance!
Does this pre-provisioned credentials help you? https://docs.openstack.org/tempest/latest/configuration.html#pre-provisioned... -- Masayuki Igawa Key fingerprint = C27C 2F00 3A2A 999A 903A 753D 290F 53ED C899 BF89
When I try this it just skips the tests, and doesn't say anywhere why. I added this to my tempest.conf: [auth] test_accounts_file = /home/ukalifon/src/tempest/cloud-01/accounts.yaml use_dynamic_credentials = False And my accounts.yaml looks like this: - username: 'admin' tenant_name: 'admin' password: 'cYsJrqtj7IvC581DxsLZkXlku' Regards, Udi Kalifon; Senior QE; RHOS-UI Automation On Fri, Jan 18, 2019 at 11:08 AM Masayuki Igawa <masayuki.igawa@gmail.com> wrote:
Hi,
On Thu, Jan 17, 2019, at 17:58, Udi Kalifon wrote: :
So I'm looking for a way to utilize the client without it automatically creating itself dynamic credentials; it has to use the already-existing admin credentials on the admin project in order to see the container with the plans. What's the right way to do that, please? Thanks a lot in advance!
Does this pre-provisioned credentials help you?
https://docs.openstack.org/tempest/latest/configuration.html#pre-provisioned...
-- Masayuki Igawa Key fingerprint = C27C 2F00 3A2A 999A 903A 753D 290F 53ED C899 BF89
Pre-provisioned account is the way to use the existing cred to run the Tempest. Can you check in tempest log about the reason of test skip? You can take ref of gate job for pre-provisioned accounts [1] [1] http://logs.openstack.org/50/628250/3/check/tempest-full-test-account-py3 -gmann ---- On Sat, 19 Jan 2019 01:01:22 +0900 Udi Kalifon <ukalifon@redhat.com> wrote ----
When I try this it just skips the tests, and doesn't say anywhere why. I added this to my tempest.conf: [auth] test_accounts_file = /home/ukalifon/src/tempest/cloud-01/accounts.yaml use_dynamic_credentials = False
And my accounts.yaml looks like this:- username: 'admin' tenant_name: 'admin' password: 'cYsJrqtj7IvC581DxsLZkXlku'
Regards, Udi Kalifon; Senior QE; RHOS-UI Automation
On Fri, Jan 18, 2019 at 11:08 AM Masayuki Igawa <masayuki.igawa@gmail.com> wrote: Hi,
On Thu, Jan 17, 2019, at 17:58, Udi Kalifon wrote: :
So I'm looking for a way to utilize the client without it automatically creating itself dynamic credentials; it has to use the already-existing admin credentials on the admin project in order to see the container with the plans. What's the right way to do that, please? Thanks a lot in advance!
Does this pre-provisioned credentials help you? https://docs.openstack.org/tempest/latest/configuration.html#pre-provisioned...
-- Masayuki Igawa Key fingerprint = C27C 2F00 3A2A 999A 903A 753D 290F 53ED C899 BF89
Thanks to everyone who helped! I was able to disable dynamic credentials like this: 1) Add a reference to an accounts file in tempest.conf, and disable the use of dynamic credentials: [auth] test_accounts_file = /home/ukalifon/src/tempest/cloud-01/accounts.yaml use_dynamic_credentials = False 2) The accounts.yaml file must contain at least 2 uses, one admin and one regular. Mine looks like this: - username: 'admin' tenant_name: 'admin' password: 'cYsJrqtj7IvC581DxsLZkXlku' roles: - 'admin' - username: 'johndoe' tenant_name: 'admin' password: 'johndoe' roles: - '_member_' 3) I needed to create the regular user that I placed in my accounts.yaml: openstack user create --project admin --password johndoe johndoe openstack role add --project admin --user johndoe _member_ Regards, Udi Kalifon; Senior QE; RHOS-UI Automation On Sun, Jan 20, 2019 at 1:06 PM Ghanshyam Mann <gmann@ghanshyammann.com> wrote:
Pre-provisioned account is the way to use the existing cred to run the Tempest. Can you check in tempest log about the reason of test skip? You can take ref of gate job for pre-provisioned accounts [1]
[1] http://logs.openstack.org/50/628250/3/check/tempest-full-test-account-py3
-gmann
---- On Sat, 19 Jan 2019 01:01:22 +0900 Udi Kalifon <ukalifon@redhat.com> wrote ----
When I try this it just skips the tests, and doesn't say anywhere why. I added this to my tempest.conf: [auth] test_accounts_file = /home/ukalifon/src/tempest/cloud-01/accounts.yaml use_dynamic_credentials = False
And my accounts.yaml looks like this:- username: 'admin' tenant_name: 'admin' password: 'cYsJrqtj7IvC581DxsLZkXlku'
Regards, Udi Kalifon; Senior QE; RHOS-UI Automation
On Fri, Jan 18, 2019 at 11:08 AM Masayuki Igawa < masayuki.igawa@gmail.com> wrote: Hi,
On Thu, Jan 17, 2019, at 17:58, Udi Kalifon wrote: :
So I'm looking for a way to utilize the client without it automatically creating itself dynamic credentials; it has to use the already-existing admin credentials on the admin project in order to see the container with the plans. What's the right way to do that, please? Thanks a lot in advance!
Does this pre-provisioned credentials help you?
https://docs.openstack.org/tempest/latest/configuration.html#pre-provisioned...
-- Masayuki Igawa Key fingerprint = C27C 2F00 3A2A 999A 903A 753D 290F 53ED C899 BF89
participants (3)
-
Ghanshyam Mann
-
Masayuki Igawa
-
Udi Kalifon