Bug 1746090

Summary: Barbican tempest plugin package needs update, it incompatible with tempest package
Product: Red Hat OpenStack Reporter: David Paterson <david_paterson>
Component: python-barbican-tests-tempestAssignee: Ade Lee <alee>
Status: CLOSED ERRATA QA Contact: Pavan <pkesavar>
Severity: low Docs Contact:
Priority: medium    
Version: 13.0 (Queens)CC: alee, arkady_kanevsky, christopher_dearborn, david_paterson, dcain, gael_rehault, hrybacki, jagee, kbasil, kholtz, kurt_hey, mburns, morazi, pgrist, rajini.karthik
Target Milestone: z11Keywords: Triaged, ZStream
Target Release: 13.0 (Queens)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-barbican-tests-tempest-0.1.0-0.20180828144800.b8bf147.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-10 11:52:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1458798    

Description David Paterson 2019-08-27 16:02:39 UTC
Description of problem:
Running any barbican tempest tests fail.

Version-Release number of selected component (if applicable):
python2-barbican-tests-tempest.noarch 0.0.1-0.20180328044348.5ddcc7e.el7ost
python2-tempest.noarch                1:18.0.0-8.el7ost  
python2-tempestconf.noarch            2.2.0-1.el7ost     

How reproducible:
Everytime

Steps to Reproduce:
1. ostestr --regex barbican
2.
3.

Actual results:
{3} setUpClass (barbican_tempest_plugin.tests.scenario.test_image_signing.ImageSigningSnapshotTest) [0.000000s] ... FAILED

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/tempest/test.py", line 172, in setUpClass
        six.reraise(etype, value, trace)
      File "/usr/lib/python2.7/site-packages/tempest/test.py", line 162, in setUpClass
        cls.setup_clients()
      File "/usr/lib/python2.7/site-packages/barbican_tempest_plugin/tests/scenario/test_image_signing.py", line 92, in setup_clients
        super(ImageSigningSnapshotTest, cls).setup_clients()
      File "/usr/lib/python2.7/site-packages/barbican_tempest_plugin/tests/scenario/barbican_manager.py", line 67, in setup_clients
        super(BarbicanScenarioTest, cls).setup_clients()
      File "/usr/lib/python2.7/site-packages/barbican_tempest_plugin/tests/scenario/manager.py", line 82, in setup_clients
        cls.volumes_client = cls.os_primary.volumes_client
    AttributeError: 'Manager' object has no attribute 'volumes_client'

Expected results: Test should pass


Additional info:
You will reach this condition if tempest.conf is as follows:
[volume-feature-enabled]
# Setting v2 to false is what breaks it.
api_v2 = False
api_v3 = True

I was able to hack manager.py and barbican_manager.py to work correctly with the installed version of tempest.  

# Logic is wrong in
# /usr/lib/python2.7/site-packages/barbican_tempest_plugin/tests/scenario/manager.py#79
 if CONF.volume_feature_enabled.api_v2:
            cls.volumes_client = cls.os_primary.volumes_v2_client
            cls.snapshots_client = cls.os_primary.snapshots_v2_client
        else:
            cls.volumes_client = cls.os_primary.volumes_client
            cls.snapshots_client = cls.os_primary.snapshots_client
            
 # we only need to check for api_v1 and if it is enabled we use volumes_client,
 # otherwise for api v2 and v3 we just use volumes_client_latest.
 
 if CONF.volume_feature_enabled.api_v1:
     cls.volumes_client = cls.os_primary.volumes_client
     cls.snapshots_client = cls.os_primary.snapshots_client
     cls.volume_types_client = cls.os_primary.volume_v1.TypesClient()
 else:
     cls.volumes_client = cls.os_primary.volumes_client_latest
     cls.snapshots_client = cls.os_primary.snapshots_client_latest
     if CONF.volume_feature_enabled.api_v2:
         cls.volume_types_client = cls.os_primary.volume_v2.TypesClient()
     else if CONF.volume_feature_enabled.api_v3:
         cls.volume_types_client = cls.os_primary.volume_v3.TypesClient()

# from /usr/lib/python2.7/site-packages/barbican_tempest_plugin/tests/scenario/barbican_manager.py#83
 if CONF.compute_feature_enabled.attach_encrypted_volume:
    if CONF.volume_feature_enabled.api_v2:
        cls.admin_volume_types_client =\
            os_adm.volume_types_v2_client
        cls.admin_encryption_types_client =\
            os_adm.encryption_types_v2_client
    else:
        cls.admin_volume_types_client =\
            os_adm.volume_types_client
        cls.admin_encryption_types_client =\
            os_adm.encryption_types_client
            
# Should be using same volume type and encryption types
# clients for both v2 and v3 apis
if CONF.compute_feature_enabled.attach_encrypted_volume:
    if (CONF.volume_feature_enabled.api_v2 or
       CONF.volume_feature_enabled.api_v3):
        cls.admin_volume_types_client =\
            os_adm.volume_types_v2_client
        cls.admin_encryption_types_client =\
            os_adm.encryption_types_v2_client
    else:
        cls.admin_volume_types_client =\
            os_adm.volume_types_client
        cls.admin_encryption_types_client =\
            os_adm.encryption_types_client



I looked upstream and it appears master branch of the barbican tempest plugin has also been updated to work with latest tempest client code, the barbican package just needs an update I think.

Comment 1 Ade Lee 2019-09-18 14:22:39 UTC
commit c9f0b5d46b17bc55182489150bd6cc6a0399d204 fixes this in the master branch upstream.

It looks like the queens spec file is tied to a specific commit.  We need to just update this to latest.
https://github.com/rdo-packages/barbican-tempest-plugin-distgit/blob/queens-rdo/python-barbican-tests-tempest.spec

Rocky, Stein and Master are not tied to a specific version.  There are no branches for different releases.

So, yeah, just need to update the commit hash to a later version.

Comment 4 David Paterson 2020-01-30 15:34:13 UTC
Has this fix been released in zstream?

Comment 5 Jason Joyce 2020-01-30 20:31:03 UTC
The fix is targeted to be shipped as part of the next z-stream.

Comment 11 errata-xmlrpc 2020-03-10 11:52:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0769