Bug 2059099

Summary: create_firewall_rule: error: argument --ip-version: invalid choice: 5 (choose from 4, 6)
Product: Red Hat OpenStack Reporter: Arie Bregman <abregman>
Component: python-neutronclientAssignee: Miguel Lavalle <mlavalle>
Status: CLOSED ERRATA QA Contact: Fiorella Yanac <fyanac>
Severity: medium Docs Contact:
Priority: medium    
Version: 17.0 (Wallaby)CC: apevec, bcafarel, ccamposr, chrisw, ekuris, jschluet, scohen, skaplons
Target Milestone: gaKeywords: AutomationBlocker, Triaged
Target Release: 17.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-neutronclient-7.3.0-0.20220707060727.4963c7a.el9ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-21 12:19:32 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:

Description Arie Bregman 2022-02-28 08:15:12 UTC
Unit tests fail in OSP 17 CI:


2022-02-28 07:28:38.759990 | container | Captured traceback:
2022-02-28 07:28:38.759996 | container | ~~~~~~~~~~~~~~~~~~~
2022-02-28 07:28:38.760003 | container |     Traceback (most recent call last):
2022-02-28 07:28:38.760009 | container |
2022-02-28 07:28:38.760015 | container |       File "/root/src/.../python-neutronclient/neutronclient/tests/unit/test_cli20.py", line 1214, in test_list_resources_yaml
2022-02-28 07:28:38.760021 | container |     data = yaml.load(''.join(self.fake_stdout.content))
2022-02-28 07:28:38.760028 | container |
2022-02-28 07:28:38.760034 | container |     TypeError: load() missing 1 required positional argument: 'Loader'
2022-02-28 07:28:38.760048 | container |
2022-02-28 07:28:38.760054 | container |
2022-02-28 07:28:38.760060 | container | neutronclient.tests.unit.test_cli20.CLITestV20OutputFormatter.test_show_resource_yaml
2022-02-28 07:28:38.760075 | container | -------------------------------------------------------------------------------------

To reproduce:

1. Clone the project
2. Checkout OSP 17 branch
3. Run unit tests (py39)

Comment 2 Miguel Lavalle 2022-03-09 00:36:24 UTC
There are two types of failures happening in the python-neutronclient unit tests:

1) "load() missing 1 required positional argument: 'Loader'" with some test cases in neutronclient.tests.unit.test_cli20.CLITestV20OutputFormatter. The problem is that PyYAML yaml.load() requires now a second argument, 'Loader'. This was fixed in upstream master with https://review.opendev.org/c/openstack/python-neutronclient/+/801224, but it wasn't backported to Wallaby. This is because in upstream Wallaby the unit tests are executed in a py38 environment: https://github.com/openstack/python-neutronclient/blob/c58eaf1b15e8b68dd8579f68cac940e7909fe7ef/tox.ini#L2. The version of PyYAML in this py38 environment had deprecated calling yaml.load() without the second argument 'Loader', but still supported it. That is not the case in py39, which is what we are using downstream to run these tests.

2) "AttributeError: module 'testtools.helpers' has no attribute 'safe_hasattr'" with some test cases in neutronclient.tests.unit.test_command_meta.TestCommandMeta. The problem in this case is that testtools 2.5.0 removed the utility function 'safe_hasattr' as explained here: https://github.com/testing-cabal/testtools/blob/2.5.0/NEWS#L31. Again, the problem was fixed in upstream master with https://review.opendev.org/c/openstack/python-neutronclient/+/802306, but it wasn't backported to Wallaby. So, again, we find this issue because we are running these test cases in a py39 environment, whereas upstream Wallaby uses a py38 environment.

So the question here is why don't we align ourselves with upstream and run these unit tests in a py38 environment?

Comment 3 Arie Bregman 2022-03-22 06:39:17 UTC
(In reply to Miguel Lavalle from comment #2)
> There are two types of failures happening in the python-neutronclient unit
> tests:
> 
> 1) "load() missing 1 required positional argument: 'Loader'" with some test
> cases in neutronclient.tests.unit.test_cli20.CLITestV20OutputFormatter. The
> problem is that PyYAML yaml.load() requires now a second argument, 'Loader'.
> This was fixed in upstream master with
> https://review.opendev.org/c/openstack/python-neutronclient/+/801224, but it
> wasn't backported to Wallaby. This is because in upstream Wallaby the unit
> tests are executed in a py38 environment:
> https://github.com/openstack/python-neutronclient/blob/
> c58eaf1b15e8b68dd8579f68cac940e7909fe7ef/tox.ini#L2. The version of PyYAML
> in this py38 environment had deprecated calling yaml.load() without the
> second argument 'Loader', but still supported it. That is not the case in
> py39, which is what we are using downstream to run these tests.
> 
> 2) "AttributeError: module 'testtools.helpers' has no attribute
> 'safe_hasattr'" with some test cases in
> neutronclient.tests.unit.test_command_meta.TestCommandMeta. The problem in
> this case is that testtools 2.5.0 removed the utility function
> 'safe_hasattr' as explained here:
> https://github.com/testing-cabal/testtools/blob/2.5.0/NEWS#L31. Again, the
> problem was fixed in upstream master with
> https://review.opendev.org/c/openstack/python-neutronclient/+/802306, but it
> wasn't backported to Wallaby. So, again, we find this issue because we are
> running these test cases in a py39 environment, whereas upstream Wallaby
> uses a py38 environment.
> 
> So the question here is why don't we align ourselves with upstream and run
> these unit tests in a py38 environment?

We run the tests from OSP 17 branch, not Wallaby. OSP 17 as far as I know is going to be released using Python 3.9

Comment 4 Miguel Lavalle 2022-03-23 21:58:44 UTC
Arie,

Thanks for your response. I have started the back-porting of the necessary changes to the test cases upstream:

https://review.opendev.org/c/openstack/python-neutronclient/+/834930

https://review.opendev.org/c/openstack/python-neutronclient/+/834942

Comment 5 Bernard Cafarelli 2022-06-17 08:31:22 UTC
wallaby backport is merged

Comment 13 errata-xmlrpc 2022-09-21 12:19:32 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 (Release of components for Red Hat OpenStack Platform 17.0 (Wallaby)), 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/RHEA-2022:6543