Fix tests in the stable branches

The stable maintenance tests are run using the current CI images
(appropriately enough, since that's the environment a stable branch
is likely to be deployed in).  In any case, there have been some
distro changes affecting py27 reflected in the current images and
the tests are failing [0].

This patch includes two changes:
- eventlet issue <0.22.0 (impacts functional tests)
  (cherry picked from commit 6f63d28d9b)

- fixtures must be imported absolutely or they aren't monkey patched
  (change could not be cherry-picked from master because some other
  refactoring occurred that would make for a non-trivial backport, and
  it's not worth the risk)

[0] http://lists.openstack.org/pipermail/openstack-stable-maint/2018-February/007235.html

Co-authored by: Erno Kuvaja <jokke@usr.fi>
Co-authored by: Brian Rosmaita <rosmaita.fossdev@gmail.com>
Closes-bug: #1747304
Change-Id: Ib9f8a52136e25d1cb609d465ca5d859523d9acc6
This commit is contained in:
Erno Kuvaja 2018-01-25 16:16:22 +00:00 committed by Brian Rosmaita
parent 06af2eb5ab
commit 3a638140ca
14 changed files with 64 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
# 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

@ -28,4 +28,10 @@ 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

@ -15,6 +15,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