[qa] dynamic credentials with the tempest swift client

Udi Kalifon ukalifon at redhat.com
Tue Jan 15 16:58:37 UTC 2019


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/cc715537a0c048b7a8692a0c8304b94d/roles/a7e0a38246d24ad58c9ca06d2db98099
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20190115/adfbb12a/attachment-0001.html>


More information about the openstack-discuss mailing list