From 60f9c54df7d06a251708d1e35364cdf2b94e46fb Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Wed, 21 Jun 2023 22:04:01 -0700 Subject: [PATCH] Address pre-checkin issues - Skip bandit error B113 - Fix some style errors - Adjust requirements - Stop running python27 jobs - Remove unit test jobs as on zuul tempest plugins are not loaded Change-Id: I14fa84dfe8ed8f30f7bc4e2432b92c1b6387eb3e --- .zuul.yaml | 9 ++++++--- lower-constraints.txt | 7 +++---- requirements.txt | 2 +- test-requirements.txt | 20 +++++++++---------- tox.ini | 9 +++++---- .../lib/feature_manager.py | 2 +- .../tests/nsxv3/api/test_nsx_mac_learning.py | 4 ++-- .../test_multiple_allow_address_pair.py | 3 ++- .../tests/scenario/test_qos.py | 2 +- 9 files changed, 30 insertions(+), 28 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 2420a0c..42f8572 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,6 +1,9 @@ - project: templates: - - openstack-python-jobs-neutron - - openstack-lower-constraints-jobs - - openstack-python36-jobs - check-requirements + check: + jobs: + - openstack-tox-pep8 + gate: + jobs: + - openstack-tox-pep8 diff --git a/lower-constraints.txt b/lower-constraints.txt index 907d697..06a9491 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -1,15 +1,14 @@ -coverage==4.0 hacking>=1.1.0 # Apache-2.0 flake8-import-order==0.12 mock==2.0.0 -neutron-lib==1.26.0 +neutron-lib==3.4.0 openstackdocstheme==2.2.0 -os-testr==1.0.0 +os-testr==3.0.0 oslotest==3.2.0 pbr==4.0.0 pylint==2.1.0 python-subunit==1.0.0 -reno==3.1.0 stestr==2.0.0 +stevedore==4.0.0 tempest==17.1.0 testtools==2.2.0 diff --git a/requirements.txt b/requirements.txt index 14fa1ab..7f080a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,5 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. +neutron-lib>=3.4.0 pbr>=4.0.0 # Apache-2.0 -neutron-lib>=1.26.0 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index 917139e..42d2bcf 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,16 +4,14 @@ hacking>=1.1.0 # Apache-2.0 -bandit!=1.6.0,>=1.1.0 # Apache-2.0 -coverage!=4.4,>=4.0 # Apache-2.0 +bandit # Apache 2.0 flake8-import-order==0.12 # LGPLv3 -mock>=2.0.0 # BSD -python-subunit>=1.0.0 # Apache-2.0/BSD -oslotest>=3.2.0 # Apache-2.0 -testtools>=2.2.0 # MIT -# releasenotes -reno>=3.1.0 # Apache-2.0 -tempest>=17.1.0 # Apache-2.0 -os-testr>=1.0.0 # Apache-2.0 +mock>=2.0.0 +os-testr>=3.0.0 +oslotest>=3.2.0 pylint==2.1.0 # GPLv2 -stestr>=2.0.0 # Apache-2.0 +python-subunit>=1.0.0 +stestr>=2.0.0 +stevedore>=4.0.0 +tempest>=17.1.0 # Apache-2.0 +testtools>=2.2.0 diff --git a/tox.ini b/tox.ini index 530cddd..e93f3ce 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,11 @@ [tox] minversion = 3.1 -envlist = py36,pep8,docs +envlist = py39,pep8,docs skipsdist = True [testenv] -basepython = python3 +basepython = python3.9 usedevelop = True install_command = pip install {opts} {packages} setenv = @@ -17,7 +17,7 @@ deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -whitelist_externals = sh +allowlist_externals = sh rm find commands = @@ -89,9 +89,10 @@ import-order-style = pep8 [testenv:bandit] basepython = python3 # B108 hardcoded_tmp_directory - remove when fixed +# B113 request_without_timeout # B602 subprocess_popen_with_shell_equals_true - removed when fixed # B605 start_process_with_a_shell - remove when fixed -commands = bandit -r vmware_nsx_tempest_plugin -n 5 -s B108,B602,B605 -ll +commands = bandit -r vmware_nsx_tempest_plugin -n 5 -s B108,B602,B605,B113 -ll [testenv:lower-constraints] basepython = python3 diff --git a/vmware_nsx_tempest_plugin/lib/feature_manager.py b/vmware_nsx_tempest_plugin/lib/feature_manager.py index 64b7cda..d4bd088 100644 --- a/vmware_nsx_tempest_plugin/lib/feature_manager.py +++ b/vmware_nsx_tempest_plugin/lib/feature_manager.py @@ -1848,7 +1848,7 @@ class FeatureManager(traffic_manager.IperfManager, present = [True for el in result if nsx_dr_rtr_name in el] if present: dr_present = True - return[{'dr_present': dr_present}, {'sr_present': sr_present}] + return [{'dr_present': dr_present}, {'sr_present': sr_present}] def create_project_octavia_scale(self, protocol_type, protocol_port, lb_algorithm, diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_nsx_mac_learning.py b/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_nsx_mac_learning.py index 0cab663..2433bcd 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_nsx_mac_learning.py +++ b/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_nsx_mac_learning.py @@ -235,9 +235,9 @@ class NSXv3MacLearningTest(base.BaseNetworkTest): test_ports_in_body = [] # Verify the each port exists in the list of all ports for tport in body['ports']: - if(nill_nsx['display_name'] == tport['name']): + if (nill_nsx['display_name'] == tport['name']): test_ports_in_body.append(nill_nsx['display_name']) - if(ml_port_nsx['display_name'] == tport['name']): + if (ml_port_nsx['display_name'] == tport['name']): test_ports_in_body.append(ml_port_nsx['display_name']) self.assertEqual(len(test_ports_in_body), 2, 'List ports does not match num of created ports') diff --git a/vmware_nsx_tempest_plugin/tests/scenario/test_multiple_allow_address_pair.py b/vmware_nsx_tempest_plugin/tests/scenario/test_multiple_allow_address_pair.py index 7757a65..a2980fb 100644 --- a/vmware_nsx_tempest_plugin/tests/scenario/test_multiple_allow_address_pair.py +++ b/vmware_nsx_tempest_plugin/tests/scenario/test_multiple_allow_address_pair.py @@ -62,7 +62,8 @@ class MultipleAllowAddress(feature_manager.FeatureManager): manager_ip, CONF.nsxv.user, CONF.nsxv.password) def _assign_ip_address(self, ssh_source, interface_name, ip_address): - ssh_source.exec_command("sudo /sbin/ifconfig %s %s netmask 255.255.255.0 \ + ssh_source.exec_command("sudo /sbin/ifconfig %s %s " + "netmask 255.255.255.0 \ up" % (interface_name, ip_address)) def verify_ping_to_fip_from_ext_vm(self, server_details): diff --git a/vmware_nsx_tempest_plugin/tests/scenario/test_qos.py b/vmware_nsx_tempest_plugin/tests/scenario/test_qos.py index d3d372e..d20646e 100644 --- a/vmware_nsx_tempest_plugin/tests/scenario/test_qos.py +++ b/vmware_nsx_tempest_plugin/tests/scenario/test_qos.py @@ -272,7 +272,7 @@ class TestQosOps(feature_manager.FeatureManager): elif float(bw_value) - (float(max_mbps) + float(max_burst)) > 0.5: LOG.info("Traffic received: {bw}".format(bw=bw_value)) raise Exception('Traffic is not limited by bw-limit rule') - elif((float(max_mbps) + float(max_burst)) - float(bw_value)) > 0.5: + elif ((float(max_mbps) + float(max_burst)) - float(bw_value)) > 0.5: LOG.info("Traffic received: {bw}".format(bw=bw_value)) raise Exception('Traffic is limited below configured value')