From a32c6f8c2397ca34bfbe3bcc40a8d931d2108188 Mon Sep 17 00:00:00 2001 From: Ryan Tidwell Date: Mon, 6 May 2019 12:21:32 -0500 Subject: [PATCH] Convert CI jobs to python 3 This change ensures all CI jobs run against neutron-dynamic-routing run with python 3 and all test code is compatible with python 3. Change-Id: I77f940dca9239d710bb146e8cdf1d6058f2fbdd4 --- neutron_dynamic_routing/tests/tempest/scenario/base.py | 4 ++-- .../tests/tempest/scenario/base_test_proto.py | 10 +++++----- .../tests/tempest/scenario/basic/test_basic.py | 6 +++--- .../neutron-dynamic-routing-dsvm-functional/run.yaml | 1 + .../neutron-dynamic-routing-dsvm-tempest-api/run.yaml | 1 + .../run.yaml | 1 + .../run.yaml | 1 + .../run.yaml | 1 + .../run.yaml | 1 + tox.ini | 3 +++ 10 files changed, 19 insertions(+), 10 deletions(-) diff --git a/neutron_dynamic_routing/tests/tempest/scenario/base.py b/neutron_dynamic_routing/tests/tempest/scenario/base.py index 0615ec6b..24b79e18 100644 --- a/neutron_dynamic_routing/tests/tempest/scenario/base.py +++ b/neutron_dynamic_routing/tests/tempest/scenario/base.py @@ -124,10 +124,10 @@ class BgpSpeakerScenarioTestJSONBase(base.BaseAdminNetworkTest): while True: with self.lock: try: - yield (i, str(subnet_gen.next())) + yield (i, str(next(subnet_gen))) except StopIteration: subnet_gen = netaddr.iter_iprange(start, end, step=step) - yield (i, str(subnet_gen.next())) + yield (i, str(next(subnet_gen))) i += 1 def net_resource_cleanup(self): diff --git a/neutron_dynamic_routing/tests/tempest/scenario/base_test_proto.py b/neutron_dynamic_routing/tests/tempest/scenario/base_test_proto.py index 3a3ee3a3..e690b0b8 100644 --- a/neutron_dynamic_routing/tests/tempest/scenario/base_test_proto.py +++ b/neutron_dynamic_routing/tests/tempest/scenario/base_test_proto.py @@ -27,7 +27,7 @@ class BgpSpeakerProtoTestBase(base.BgpSpeakerScenarioTestJSONBase): def _test_check_neighbor_established(self, ip_version): self.bgp_peer_args[0]['peer_ip'] = self.r_as_ip[0].split('/')[0] - num, subnet = self.tnet_gen.next() + num, subnet = next(self.tnet_gen) mask = '/' + str(self.TPool.prefixlen) TNet = base.Net(name='', net=subnet, mask=self.TPool.prefixlen, cidr=subnet + mask, router=None) @@ -46,7 +46,7 @@ class BgpSpeakerProtoTestBase(base.BgpSpeakerScenarioTestJSONBase): def _test_check_advertised_tenant_network(self, ip_version): self.bgp_peer_args[0]['peer_ip'] = self.r_as_ip[0].split('/')[0] - num, subnet = self.tnet_gen.next() + num, subnet = next(self.tnet_gen) mask = '/' + str(self.TPool.prefixlen) TNet = base.Net(name='', net=subnet, mask=self.TPool.prefixlen, cidr=subnet + mask, router=None) @@ -72,7 +72,7 @@ class BgpSpeakerProtoTestBase(base.BgpSpeakerScenarioTestJSONBase): tnets = [] tnets_cidr = [] for i in range(0, 3): - num, subnet = self.tnet_gen.next() + num, subnet = next(self.tnet_gen) mask = '/' + str(self.TPool.prefixlen) TNet = base.Net(name='', net=subnet, mask=self.TPool.prefixlen, cidr=subnet + mask, router=None) @@ -101,7 +101,7 @@ class BgpSpeakerProtoTestBase(base.BgpSpeakerScenarioTestJSONBase): for (bgp_peer_args, r_as_ip) in zip(self.bgp_peer_args, self.r_as_ip): bgp_peer_args['peer_ip'] = r_as_ip.split('/')[0] - num, subnet = self.tnet_gen.next() + num, subnet = next(self.tnet_gen) mask = '/' + str(self.TPool.prefixlen) TNet = base.Net(name='', net=subnet, mask=self.TPool.prefixlen, cidr=subnet + mask, router=None) @@ -123,7 +123,7 @@ class BgpSpeakerProtoTestBase(base.BgpSpeakerScenarioTestJSONBase): for (bgp_peer_args, r_as_ip) in zip(self.bgp_peer_args, self.r_as_ip): bgp_peer_args['peer_ip'] = r_as_ip.split('/')[0] - num, subnet = self.tnet_gen.next() + num, subnet = next(self.tnet_gen) mask = '/' + str(self.TPool.prefixlen) TNet = base.Net(name='', net=subnet, mask=self.TPool.prefixlen, cidr=subnet + mask, router=None) diff --git a/neutron_dynamic_routing/tests/tempest/scenario/basic/test_basic.py b/neutron_dynamic_routing/tests/tempest/scenario/basic/test_basic.py index bba1400c..83faa2ea 100644 --- a/neutron_dynamic_routing/tests/tempest/scenario/basic/test_basic.py +++ b/neutron_dynamic_routing/tests/tempest/scenario/basic/test_basic.py @@ -31,7 +31,7 @@ class BgpSpeakerBasicTest(base.BgpSpeakerBasicTestJSONBase): @decorators.idempotent_id('cc615252-c6cb-4d75-a70e-608fb2c3736a') def test_schedule_added_speaker(self): self.bgp_peer_args[0]['peer_ip'] = self.r_as_ip[0].split('/')[0] - num, subnet = self.tnet_gen.next() + num, subnet = next(self.tnet_gen) mask = '/' + str(self.TPool.prefixlen) TNet = s_base.Net(name='', net=subnet, mask=self.TPool.prefixlen, cidr=subnet + mask, router=None) @@ -51,7 +51,7 @@ class BgpSpeakerBasicTest(base.BgpSpeakerBasicTestJSONBase): @decorators.idempotent_id('ce98c33c-0ffa-49ae-b365-da836406793b') def test_unschedule_deleted_speaker(self): self.bgp_peer_args[0]['peer_ip'] = self.r_as_ip[0].split('/')[0] - num, subnet = self.tnet_gen.next() + num, subnet = next(self.tnet_gen) mask = '/' + str(self.TPool.prefixlen) TNet = s_base.Net(name='', net=subnet, mask=self.TPool.prefixlen, cidr=subnet + mask, router=None) @@ -77,7 +77,7 @@ class BgpSpeakerBasicTest(base.BgpSpeakerBasicTestJSONBase): @decorators.idempotent_id('aa6c565c-ded3-413b-8dc9-3928b3b0e38f') def test_remove_add_speaker_agent(self): self.bgp_peer_args[0]['peer_ip'] = self.r_as_ip[0].split('/')[0] - num, subnet = self.tnet_gen.next() + num, subnet = next(self.tnet_gen) mask = '/' + str(self.TPool.prefixlen) TNet = s_base.Net(name='', net=subnet, mask=self.TPool.prefixlen, cidr=subnet + mask, router=None) diff --git a/playbooks/neutron-dynamic-routing-dsvm-functional/run.yaml b/playbooks/neutron-dynamic-routing-dsvm-functional/run.yaml index 9713e4af..eccadc1f 100644 --- a/playbooks/neutron-dynamic-routing-dsvm-functional/run.yaml +++ b/playbooks/neutron-dynamic-routing-dsvm-functional/run.yaml @@ -28,6 +28,7 @@ cmd: | set -e set -x + export DEVSTACK_GATE_USE_PYTHON3=True export PYTHONUNBUFFERED=true export DEVSTACK_GATE_UNSTACK=1 export DEVSTACK_GATE_TEMPEST=0 diff --git a/playbooks/neutron-dynamic-routing-dsvm-tempest-api/run.yaml b/playbooks/neutron-dynamic-routing-dsvm-tempest-api/run.yaml index 52521c14..63b8e7ec 100644 --- a/playbooks/neutron-dynamic-routing-dsvm-tempest-api/run.yaml +++ b/playbooks/neutron-dynamic-routing-dsvm-tempest-api/run.yaml @@ -42,6 +42,7 @@ cmd: | set -e set -x + export DEVSTACK_GATE_USE_PYTHON3=True export PYTHONUNBUFFERED=true export DEVSTACK_GATE_TEMPEST=1 if [ "ZUUL_BRANCH" == "stable/newton" ]; then diff --git a/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-basic/run.yaml b/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-basic/run.yaml index 64b3a340..62925dae 100644 --- a/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-basic/run.yaml +++ b/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-basic/run.yaml @@ -28,6 +28,7 @@ cmd: | set -e set -x + export DEVSTACK_GATE_USE_PYTHON3=True export PYTHONUNBUFFERED=true export DEVSTACK_GATE_TEMPEST=1 export DEVSTACK_GATE_TEMPEST_REGEX="^neutron_dynamic_routing.tests.tempest.scenario.basic\." diff --git a/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-ipv4/run.yaml b/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-ipv4/run.yaml index 33c4d087..6be06c50 100644 --- a/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-ipv4/run.yaml +++ b/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-ipv4/run.yaml @@ -28,6 +28,7 @@ cmd: | set -e set -x + export DEVSTACK_GATE_USE_PYTHON3=True export PYTHONUNBUFFERED=true export DEVSTACK_GATE_TEMPEST=1 export DEVSTACK_GATE_TEMPEST_REGEX="^neutron_dynamic_routing.tests.tempest.scenario.ipv4\." diff --git a/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-ipv6/run.yaml b/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-ipv6/run.yaml index 634960b4..ae2761b4 100644 --- a/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-ipv6/run.yaml +++ b/playbooks/neutron-dynamic-routing-dsvm-tempest-scenario-ipv6/run.yaml @@ -28,6 +28,7 @@ cmd: | set -e set -x + export DEVSTACK_GATE_USE_PYTHON3=True export PYTHONUNBUFFERED=true export DEVSTACK_GATE_TEMPEST=1 export DEVSTACK_GATE_TEMPEST_REGEX="^neutron_dynamic_routing.tests.tempest.scenario.ipv6\." diff --git a/playbooks/neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4/run.yaml b/playbooks/neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4/run.yaml index 13a8e73a..cd9b38a7 100644 --- a/playbooks/neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4/run.yaml +++ b/playbooks/neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4/run.yaml @@ -28,6 +28,7 @@ cmd: | set -e set -x + export DEVSTACK_GATE_USE_PYTHON3=True export PYTHONUNBUFFERED=true export DEVSTACK_GATE_TEMPEST=1 export DEVSTACK_GATE_TEMPEST_REGEX="^neutron_dynamic_routing.tests.tempest.scenario.ipv4\." diff --git a/tox.ini b/tox.ini index 22521318..b5fa0e73 100644 --- a/tox.ini +++ b/tox.ini @@ -26,12 +26,14 @@ commands = # mode. To do this define the TRACE_FAILONLY environmental variable. [testenv:functional] +basepython = python3 setenv = OS_TEST_PATH=./neutron_dynamic_routing/tests/functional commands = stestr run {posargs} stestr slowest [testenv:api] +basepython = python3 sitepackages=True setenv = OS_TEST_PATH=./neutron_dynamic_routing/tests/tempest/api/ @@ -42,6 +44,7 @@ commands = stestr slowest [testenv:dsvm-functional] +basepython = python3 setenv = OS_TEST_PATH=./neutron_dynamic_routing/tests/functional OS_SUDO_TESTING=1