running test_container_synchronization gets Unauthorized error

Bug #1740075 reported by zhufl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Undecided
zhufl

Bug Description

1. Problem
Running tempest.api.object_storage.test_container_sync_middleware.ContainerSyncMiddlewareTest.test_container_synchronization along with all other swift testcases will fail with Unauthorized error, but it can pass when being executed alone.

Traceback (most recent call last):
  File "/home/zfl/gx_mtest_node/tempest_m/tempest/common/utils/__init__.py", line 110, in wrapper
    return func(*func_args, **func_kwargs)
  File "/home/zfl/gx_mtest_node/tempest_m/tempest/api/object_storage/test_container_sync_middleware.py", line 53, in test_container_synchronization
    self._test_container_synchronization(make_headers)
  File "/home/zfl/gx_mtest_node/tempest_m/tempest/api/object_storage/test_container_sync.py", line 106, in _test_container_synchronization
    cont, params=params)
  File "/home/zfl/gx_mtest_node/tempest_m/tempest/lib/services/object_storage/container_client.py", line 108, in list_container_objects
    resp, body = self.get(url, headers={})
  File "/home/zfl/gx_mtest_node/tempest_m/tempest/lib/common/rest_client.py", line 302, in get
    return self.request('GET', url, extra_headers, headers)
  File "/home/zfl/gx_mtest_node/tempest_m/tempest/lib/common/rest_client.py", line 733, in request
    self._error_checker(resp, resp_body)
  File "/home/zfl/gx_mtest_node/tempest_m/tempest/lib/common/rest_client.py", line 829, in _error_checker
    raise exceptions.Unauthorized(resp_body, resp=resp)
Unauthorized: Unauthorized
Details: <html><h1>Unauthorized</h1><p>This server could not verify that you are authorized to access the document you requested.</p></html>

2. Analysis
When test_container_sync_middleware.ContainerSyncMiddlewareTest.test_container_synchronization is executed along with test_container_sync.ContainerSyncTest, because ContainerSyncMiddlewareTest inherits test_container_sync.ContainerSyncTest, and clients is a class variable, so, when ContainerSyncMiddlewareTest is executed, clients will contain data created in its parent class which will cause trouble when using dynamic credentials because the projects/users created in parent class have been deleted.

3. Solution
Do not use class variable for clients

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

Fix proposed to branch: master
Review: https://review.openstack.org/530058

Changed in tempest:
assignee: nobody → zhufl (zhu-fanglei)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest (master)

Reviewed: https://review.openstack.org/530058
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=bfa4b4e7783a1f0821b41325e7cedc2ac6993e49
Submitter: Zuul
Branch: master

commit bfa4b4e7783a1f0821b41325e7cedc2ac6993e49
Author: zhufl <email address hidden>
Date: Tue Dec 26 14:23:32 2017 +0800

    Do not use class variable for clients in ContainerSyncTest

    Running tempest.api.object_storage.test_container_sync_middleware.
    ContainerSyncMiddlewareTest.test_container_synchronization along with
    all other swift testcases will fail with Unauthorized error, but it can
    pass when being executed alone.

    This is because clients in parent class ContainerSyncTest is a class
    variable, which will cause trouble when using dynamic credentials. So
    this is to change clients to an instance variable.

    Change-Id: I10f04fadae95932258a5df58ef68d80f81075b79
    Closes-Bug: #1740075

Changed in tempest:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tempest 18.0.0

This issue was fixed in the openstack/tempest 18.0.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.