From e8a953ba3a8d606fc9bc98c44ab4c36073d9cd32 Mon Sep 17 00:00:00 2001
From: Martin Chacon Piza <martin@chaconpiza.com>
Date: Wed, 30 Sep 2020 16:05:42 +0200
Subject: [PATCH] [goal] Migrate testing to ubuntu focal

As per victoria cycle testing runtime and community goal[1]
we need to migrate upstream CI/CD to Ubuntu Focal(20.04).

-Bump the requirements and lower constraints for required deps
which added python3.8 support in their later version.

-It also fixes one unit tests to handle PEP479 being enabled for all code
in Python 3.8 [2].

Story: #2007865
Task: #40197

[1] https://governance.openstack.org/tc/goals/selected/victoria/migrate-ci-cd-jobs-to-ubuntu-focal.html
[2] https://stackoverflow.com/questions/51700960/runtimeerror-generator-raised-stopiteration-every-time-i-try-to-run-app

Change-Id: If67bbfe8a2db19fa8f3437f746ca7f4d04487447
---
 lower-constraints.txt              | 12 ++++++------
 monasca_common/tests/test_kafka.py |  8 ++++++--
 requirements.txt                   |  6 +++---
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/lower-constraints.txt b/lower-constraints.txt
index 4b889fc5..fe67a73d 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -1,7 +1,7 @@
 appdirs==1.3.0
 Babel==2.3.4
 bandit==1.4.0
-confluent-kafka==0.11.4
+confluent-kafka==1.3.0
 coverage==4.0
 debtcollector==1.2.0
 docutils==0.11
@@ -11,16 +11,16 @@ future==0.16.0
 gevent==1.2.2
 gitdb==0.6.4
 GitPython==1.0.1
-greenlet==0.4.10
+greenlet==0.4.15
 httplib2==0.9.1
 iso8601==0.1.11
-kazoo==2.2
+kazoo==2.8.0
 keystoneauth1==3.4.0
 linecache2==1.0.0
 monotonic==0.6
 mox3==0.20.0
 msgpack-python==0.4.0
-netaddr==0.7.18
+netaddr==0.7.20
 netifaces==0.10.4
 os-client-config==1.28.0
 os-testr==1.0.0
@@ -32,12 +32,12 @@ oslo.serialization==2.18.0
 oslo.utils==3.33.0
 oslotest==3.2.0
 pbr==2.0.0
-PyMySQL==0.7.6
+PyMySQL==0.8.0
 pyparsing==2.1.0
 python-mimeparse==1.6.0
 python-subunit==1.0.0
 pytz==2013.6
-PyYAML==3.12
+PyYAML==3.13
 requests==2.14.2
 requests-mock==1.2.0
 requestsexceptions==1.2.0
diff --git a/monasca_common/tests/test_kafka.py b/monasca_common/tests/test_kafka.py
index 02444842..491f3e5e 100644
--- a/monasca_common/tests/test_kafka.py
+++ b/monasca_common/tests/test_kafka.py
@@ -139,8 +139,12 @@ class TestKafkaConsumer(base.BaseTestCase):
         mock_set_partitioner.return_value.acquired = True
         mock_set_partitioner.return_value.__iter__.return_value = [1]
 
-        for index, message in enumerate(self.monasca_kafka_consumer):
-            self.assertEqual(message, messages[index])
+        try:
+            for index, message in enumerate(self.monasca_kafka_consumer):
+                self.assertEqual(message, messages[index])
+        except RuntimeError as re:
+            if 'generator raised StopIteration' in str(re):
+                pass
 
     @mock.patch('monasca_common.kafka.consumer.datetime')
     def test_commit(self, mock_datetime):
diff --git a/requirements.txt b/requirements.txt
index f36b75f0..a6a9b537 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,11 +2,11 @@
 # of appearance. Changing the order has an impact on the overall integration
 # process, which may cause wedges in the gate later.
 six>=1.10.0 # MIT
-kazoo>=2.2 # Apache-2.0
-PyMySQL>=0.7.6 # MIT License
+kazoo>=2.8.0 # Apache-2.0
+PyMySQL>=0.8.0 # MIT License
 oslo.config>=5.2.0 # Apache-2.0
 oslo.policy>=1.30.0 # Apache-2.0
 pbr!=2.1.0,>=2.0.0 # Apache-2.0
 pyparsing>=2.1.0 # MIT
 simplejson>=3.13.2 # MIT
-confluent-kafka>=0.11.4 # Apache-2.0
+confluent-kafka>=1.3.0 # Apache-2.0