Fix tests in stable/ocata

Backport fixes due to distro changes affecting py27 causing stable
maintenance check jobs to fail.  This patch includes the following
changes:

- Invoke Monkey Patching for All Tests
  (cherry picked from commit 630402204e)

- eventlet issue <0.22.0 (impacts functional tests)
- fixtures must be imported absolutely or they aren't monkey patched
  (these two were cherry picked from commit
   3a638140ca)

- extending eventlet issue <0.22.0 fix to glare
  (new in this patch, not required in pike or master)

Closes-bug: #1747305
Change-Id: Ib9f8a52136e25d1cb609d465ca5d859523d9acc6
This commit is contained in:
Hemanth Makkapati 2017-03-22 10:42:01 -05:00 committed by Brian Rosmaita
parent d9ca87d9f7
commit 539c2fab9e
15 changed files with 73 additions and 0 deletions

View File

@ -29,6 +29,12 @@ from oslo_utils import encodeutils
# Monkey patch socket, time, select, threads
# NOTE(jokke): As per the eventlet commit
# b756447bab51046dfc6f1e0e299cc997ab343701 there's circular import happening
# which can be solved making sure the hubs are properly and fully imported
# before calling monkey_patch(). This is solved in eventlet 0.22.0 but we
# need to address it before that is widely used around.
eventlet.hubs.get_hub()
eventlet.patcher.monkey_patch(all=False, socket=True, time=True,
select=True, thread=True, os=True)

View File

@ -28,6 +28,12 @@ import eventlet
from oslo_utils import encodeutils
# NOTE(jokke): As per the eventlet commit
# b756447bab51046dfc6f1e0e299cc997ab343701 there's circular import happening
# which can be solved making sure the hubs are properly and fully imported
# before calling monkey_patch(). This is solved in eventlet 0.22.0 but we
# need to address it before that is widely used around.
eventlet.hubs.get_hub()
eventlet.patcher.monkey_patch(all=False, socket=True, time=True,
select=True, thread=True, os=True)

View File

@ -28,6 +28,12 @@ import eventlet
from oslo_utils import encodeutils
# Monkey patch socket and time
# NOTE(jokke): As per the eventlet commit
# b756447bab51046dfc6f1e0e299cc997ab343701 there's circular import happening
# which can be solved making sure the hubs are properly and fully imported
# before calling monkey_patch(). This is solved in eventlet 0.22.0 but we
# need to address it before that is widely used around.
eventlet.hubs.get_hub()
eventlet.patcher.monkey_patch(all=False, socket=True, time=True, thread=True)
# If ../glance/__init__.py exists, add ../ to Python search path, so that

View File

@ -38,6 +38,12 @@ from oslo_log import log as logging
from glance.common import config
from glance import scrubber
# NOTE(jokke): As per the eventlet commit
# b756447bab51046dfc6f1e0e299cc997ab343701 there's circular import happening
# which can be solved making sure the hubs are properly and fully imported
# before calling monkey_patch(). This is solved in eventlet 0.22.0 but we
# need to address it before that is widely used around.
eventlet.hubs.get_hub()
eventlet.patcher.monkey_patch(all=False, socket=True, time=True, select=True,
thread=True, os=True)

View File

@ -31,3 +31,12 @@ formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.DEBUG)
import eventlet
# NOTE(jokke): As per the eventlet commit
# b756447bab51046dfc6f1e0e299cc997ab343701 there's circular import happening
# which can be solved making sure the hubs are properly and fully imported
# before calling monkey_patch(). This is solved in eventlet 0.22.0 but we
# need to address it before that is widely used around.
eventlet.hubs.get_hub()
eventlet.patcher.monkey_patch()

View File

@ -21,6 +21,10 @@ and Registry server, grabbing the logs of each, cleaning up pidfiles,
and spinning down the servers.
"""
# NOTE(rosmaita): mriedem says this is needed for importing from fixtures,
# and he's right!
from __future__ import absolute_import
import atexit
import datetime
import errno

View File

@ -10,6 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
# NOTE(rosmaita): mriedem says this is needed for importing from fixtures,
# and he's right!
from __future__ import absolute_import
import atexit
import os.path
import tempfile

View File

@ -13,6 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
# NOTE(rosmaita): mriedem says this is needed for importing from fixtures,
# and he's right!
from __future__ import absolute_import
import atexit
import os.path
import tempfile

View File

@ -13,6 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
# NOTE(rosmaita): mriedem says this is needed for importing from fixtures,
# and he's right!
from __future__ import absolute_import
import os.path
import shutil

View File

@ -12,6 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
# NOTE(rosmaita): mriedem says this is needed for importing from fixtures,
# and he's right!
from __future__ import absolute_import
import fixtures
from glance.common import exception

View File

@ -14,6 +14,10 @@
# License for the specific language governing permissions and limitations
# under the License.
# NOTE(rosmaita): mriedem says this is needed for importing from fixtures,
# and he's right!
from __future__ import absolute_import
import datetime
import gettext
import os

View File

@ -12,6 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
# NOTE(rosmaita): mriedem says this is needed for importing from fixtures,
# and he's right!
from __future__ import absolute_import
import copy
import os
import sys

View File

@ -13,6 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
# NOTE(rosmaita): mriedem says this is needed for importing from fixtures,
# and he's right!
from __future__ import absolute_import
from contextlib import contextmanager
import datetime
import hashlib

View File

@ -13,6 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
# NOTE(rosmaita): mriedem says this is needed for importing from fixtures,
# and he's right!
from __future__ import absolute_import
import fixtures
import mock

View File

@ -15,6 +15,10 @@
"""Common utilities used in testing"""
# NOTE(rosmaita): mriedem says this is needed for importing from fixtures,
# and he's right!
from __future__ import absolute_import
import errno
import functools
import os