Browse Source

Merge "functional: Add and use 'GlanceFixture'"

tags/22.0.0.0rc1
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
b262e23734
70 changed files with 568 additions and 360 deletions
  1. +315
    -0
      nova/tests/fixtures.py
  2. +1
    -2
      nova/tests/functional/api_sample_tests/test_aggregates.py
  3. +2
    -2
      nova/tests/functional/api_sample_tests/test_create_backup.py
  4. +6
    -7
      nova/tests/functional/api_sample_tests/test_images.py
  5. +2
    -3
      nova/tests/functional/api_sample_tests/test_multiple_create.py
  6. +1
    -3
      nova/tests/functional/api_sample_tests/test_preserve_ephemeral_rebuild.py
  7. +11
    -22
      nova/tests/functional/api_sample_tests/test_servers.py
  8. +3
    -5
      nova/tests/functional/compute/test_resource_tracker.py
  9. +2
    -11
      nova/tests/functional/integrated_helpers.py
  10. +2
    -7
      nova/tests/functional/libvirt/test_evacuate.py
  11. +1
    -1
      nova/tests/functional/libvirt/test_numa_servers.py
  12. +5
    -7
      nova/tests/functional/libvirt/test_shared_resource_provider.py
  13. +1
    -5
      nova/tests/functional/notification_sample_tests/notification_sample_base.py
  14. +1
    -7
      nova/tests/functional/regressions/test_bug_1522536.py
  15. +3
    -8
      nova/tests/functional/regressions/test_bug_1541691.py
  16. +4
    -11
      nova/tests/functional/regressions/test_bug_1548980.py
  17. +2
    -6
      nova/tests/functional/regressions/test_bug_1558866.py
  18. +1
    -6
      nova/tests/functional/regressions/test_bug_1595962.py
  19. +1
    -5
      nova/tests/functional/regressions/test_bug_1620248.py
  20. +2
    -4
      nova/tests/functional/regressions/test_bug_1670627.py
  21. +3
    -5
      nova/tests/functional/regressions/test_bug_1671648.py
  22. +2
    -3
      nova/tests/functional/regressions/test_bug_1675570.py
  23. +1
    -3
      nova/tests/functional/regressions/test_bug_1679750.py
  24. +1
    -3
      nova/tests/functional/regressions/test_bug_1682693.py
  25. +1
    -3
      nova/tests/functional/regressions/test_bug_1689692.py
  26. +1
    -3
      nova/tests/functional/regressions/test_bug_1702454.py
  27. +1
    -5
      nova/tests/functional/regressions/test_bug_1713783.py
  28. +1
    -4
      nova/tests/functional/regressions/test_bug_1718455.py
  29. +1
    -3
      nova/tests/functional/regressions/test_bug_1718512.py
  30. +1
    -3
      nova/tests/functional/regressions/test_bug_1719730.py
  31. +3
    -4
      nova/tests/functional/regressions/test_bug_1735407.py
  32. +1
    -4
      nova/tests/functional/regressions/test_bug_1741307.py
  33. +2
    -5
      nova/tests/functional/regressions/test_bug_1746483.py
  34. +1
    -3
      nova/tests/functional/regressions/test_bug_1764556.py
  35. +3
    -5
      nova/tests/functional/regressions/test_bug_1764883.py
  36. +3
    -10
      nova/tests/functional/regressions/test_bug_1780373.py
  37. +3
    -5
      nova/tests/functional/regressions/test_bug_1781286.py
  38. +2
    -7
      nova/tests/functional/regressions/test_bug_1781710.py
  39. +2
    -6
      nova/tests/functional/regressions/test_bug_1784353.py
  40. +2
    -7
      nova/tests/functional/regressions/test_bug_1797580.py
  41. +1
    -5
      nova/tests/functional/regressions/test_bug_1806515.py
  42. +1
    -4
      nova/tests/functional/regressions/test_bug_1815153.py
  43. +1
    -3
      nova/tests/functional/regressions/test_bug_1825020.py
  44. +1
    -4
      nova/tests/functional/regressions/test_bug_1825034.py
  45. +1
    -3
      nova/tests/functional/regressions/test_bug_1830747.py
  46. +3
    -4
      nova/tests/functional/regressions/test_bug_1835822.py
  47. +1
    -2
      nova/tests/functional/regressions/test_bug_1843708.py
  48. +2
    -3
      nova/tests/functional/regressions/test_bug_1849409.py
  49. +1
    -3
      nova/tests/functional/regressions/test_bug_1852458.py
  50. +1
    -3
      nova/tests/functional/regressions/test_bug_1862633.py
  51. +3
    -10
      nova/tests/functional/regressions/test_bug_1893284.py
  52. +12
    -21
      nova/tests/functional/test_aggregates.py
  53. +1
    -4
      nova/tests/functional/test_availability_zones.py
  54. +2
    -4
      nova/tests/functional/test_boot_from_volume.py
  55. +1
    -3
      nova/tests/functional/test_cross_az_attach.py
  56. +3
    -3
      nova/tests/functional/test_cross_cell_migrate.py
  57. +1
    -3
      nova/tests/functional/test_external_networks.py
  58. +1
    -3
      nova/tests/functional/test_instance_actions.py
  59. +2
    -8
      nova/tests/functional/test_list_servers_ip_filter.py
  60. +1
    -3
      nova/tests/functional/test_metadata.py
  61. +1
    -4
      nova/tests/functional/test_nova_manage.py
  62. +1
    -3
      nova/tests/functional/test_policy.py
  63. +1
    -3
      nova/tests/functional/test_scheduler.py
  64. +1
    -4
      nova/tests/functional/test_server_faults.py
  65. +4
    -12
      nova/tests/functional/test_server_group.py
  66. +6
    -6
      nova/tests/functional/test_servers.py
  67. +2
    -3
      nova/tests/functional/test_service.py
  68. +1
    -4
      nova/tests/functional/wsgi/test_secgroup.py
  69. +10
    -12
      nova/tests/functional/wsgi/test_servers.py
  70. +100
    -0
      nova/tests/unit/test_fixtures.py

+ 315
- 0
nova/tests/fixtures.py View File

@@ -15,9 +15,11 @@
# under the License.

"""Fixtures for Nova tests."""

import collections
from contextlib import contextmanager
import copy
import datetime
import logging as std_logging
import os
import random
@@ -56,6 +58,7 @@ from nova.network import constants as neutron_constants
from nova.network import model as network_model
from nova import objects
from nova.objects import base as obj_base
from nova.objects import fields as obj_fields
from nova.objects import service as service_obj
import nova.privsep
from nova import quota as nova_quota
@@ -2046,6 +2049,318 @@ class EventReporterStub(fixtures.Fixture):
lambda *args, **kwargs: mock.MagicMock()))


class GlanceFixture(fixtures.Fixture):
"""A fixture for simulating Glance."""

# NOTE(justinsb): The OpenStack API can't upload an image?
# So, make sure we've got one..
timestamp = datetime.datetime(2011, 1, 1, 1, 2, 3)

image1 = {
'id': '155d900f-4e14-4e4c-a73d-069cbf4541e6',
'name': 'fakeimage123456',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': False,
'container_format': 'raw',
'disk_format': 'raw',
'size': '25165824',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': ['tag1', 'tag2'],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
'architecture': obj_fields.Architecture.X86_64,
},
}

image2 = {
'id': 'a2459075-d96c-40d5-893e-577ff92e721c',
'name': 'fakeimage123456',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': True,
'container_format': 'ami',
'disk_format': 'ami',
'size': '58145823',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': [],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
},
}

image3 = {
'id': '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6',
'name': 'fakeimage123456',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': True,
'container_format': 'bare',
'disk_format': 'raw',
'size': '83594576',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': ['tag3', 'tag4'],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
'architecture': obj_fields.Architecture.X86_64,
},
}

image4 = {
'id': 'cedef40a-ed67-4d10-800e-17455edce175',
'name': 'fakeimage123456',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': True,
'container_format': 'ami',
'disk_format': 'ami',
'size': '84035174',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': [],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
},
}

image5 = {
'id': 'c905cedb-7281-47e4-8a62-f26bc5fc4c77',
'name': 'fakeimage123456',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': True,
'container_format': 'ami',
'disk_format': 'ami',
'size': '26360814',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': [],
'properties': {
'kernel_id': '155d900f-4e14-4e4c-a73d-069cbf4541e6',
'ramdisk_id': None,
},
}

auto_disk_config_disabled_image = {
'id': 'a440c04b-79fa-479c-bed1-0b816eaec379',
'name': 'fakeimage6',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': False,
'container_format': 'ova',
'disk_format': 'vhd',
'size': '49163826',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': [],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
'architecture': obj_fields.Architecture.X86_64,
'auto_disk_config': 'False',
},
}

auto_disk_config_enabled_image = {
'id': '70a599e0-31e7-49b7-b260-868f441e862b',
'name': 'fakeimage7',
'created_at': timestamp,
'updated_at': timestamp,
'deleted_at': None,
'deleted': False,
'status': 'active',
'is_public': False,
'container_format': 'ova',
'disk_format': 'vhd',
'size': '74185822',
'min_ram': 0,
'min_disk': 0,
'protected': False,
'visibility': 'public',
'tags': [],
'properties': {
'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
'architecture': obj_fields.Architecture.X86_64,
'auto_disk_config': 'True',
},
}

def __init__(self, test):
super().__init__()
self.test = test
self.images = {}

def setUp(self):
super().setUp()

self.test.useFixture(
ConfPatcher(group='glance', api_servers=['http://localhost:9292'])
)
self.test.stub_out(
'nova.image.glance.API.get_remote_image_service',
lambda context, image_href: (self, image_href))
self.test.stub_out(
'nova.image.glance.get_default_image_service',
lambda: self)

self.create(None, self.image1)
self.create(None, self.image2)
self.create(None, self.image3)
self.create(None, self.image4)
self.create(None, self.image5)
self.create(None, self.auto_disk_config_disabled_image)
self.create(None, self.auto_disk_config_enabled_image)

self._imagedata = {}

# TODO(bcwaldon): implement optional kwargs such as limit, sort_dir
def detail(self, context, **kwargs):
"""Return list of detailed image information."""
return copy.deepcopy(list(self.images.values()))

def download(
self, context, image_id, data=None, dst_path=None, trusted_certs=None,
):
self.show(context, image_id)
if data:
data.write(self._imagedata.get(image_id, b''))
elif dst_path:
with open(dst_path, 'wb') as data:
data.write(self._imagedata.get(image_id, b''))

def show(
self, context, image_id, include_locations=False, show_deleted=True,
):
"""Get data about specified image.

Returns a dict containing image data for the given opaque image id.
"""
image = self.images.get(str(image_id))
if image:
return copy.deepcopy(image)

LOG.warning(
'Unable to find image id %s. Have images: %s',
image_id, self.images)
raise exception.ImageNotFound(image_id=image_id)

def create(self, context, metadata, data=None):
"""Store the image data and return the new image id.

:raises: Duplicate if the image already exist.

"""
image_id = str(metadata.get('id', uuidutils.generate_uuid()))
metadata['id'] = image_id
if image_id in self.images:
raise exception.CouldNotUploadImage(image_id=image_id)

image_meta = copy.deepcopy(metadata)

# Glance sets the size value when an image is created, so we
# need to do that here to fake things out if it's not provided
# by the caller. This is needed to avoid a KeyError in the
# image-size API.
if 'size' not in image_meta:
image_meta['size'] = None

# Similarly, Glance provides the status on the image once it's created
# and this is checked in the compute API when booting a server from
# this image, so we just fake it out to be 'active' even though this
# is mostly a lie on a newly created image.
if 'status' not in metadata:
image_meta['status'] = 'active'

# The owner of the image is by default the request context project_id.
if context and 'owner' not in image_meta.get('properties', {}):
# Note that normally "owner" is a top-level field in an image
# resource in glance but we have to fake this out for the images
# proxy API by throwing it into the generic "properties" dict.
image_meta.get('properties', {})['owner'] = context.project_id

self.images[image_id] = image_meta

if data:
self._imagedata[image_id] = data.read()

return self.images[image_id]

def update(self, context, image_id, metadata, data=None,
purge_props=False):
"""Replace the contents of the given image with the new data.

:raises: ImageNotFound if the image does not exist.
"""
if not self.images.get(image_id):
raise exception.ImageNotFound(image_id=image_id)

if purge_props:
self.images[image_id] = copy.deepcopy(metadata)
else:
image = self.images[image_id]

try:
image['properties'].update(metadata.pop('properties'))
except KeyError:
pass

image.update(metadata)

return self.images[image_id]

def delete(self, context, image_id):
"""Delete the given image.

:raises: ImageNotFound if the image does not exist.
"""
removed = self.images.pop(image_id, None)
if not removed:
raise exception.ImageNotFound(image_id=image_id)

def get_location(self, context, image_id):
if image_id in self.images:
return 'fake_location'
return None


class CinderFixture(fixtures.Fixture):
"""A fixture to volume operations with the new Cinder attach/detach API"""



+ 1
- 2
nova/tests/functional/api_sample_tests/test_aggregates.py View File

@@ -16,7 +16,6 @@
from oslo_serialization import jsonutils

from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.image import fake as fake_image


class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
@@ -132,7 +131,7 @@ class AggregatesV2_81_SampleJsonTest(AggregatesV2_41_SampleJsonTest):

def test_images(self):
agg_id = self._test_aggregate_create()
image = fake_image.get_valid_image_id()
image = self.glance.auto_disk_config_enabled_image['id']
response = self._do_post('os-aggregates/%s/images' % agg_id,
'aggregate-images-post-req',
{'image_id': image})


+ 2
- 2
nova/tests/functional/api_sample_tests/test_create_backup.py View File

@@ -15,8 +15,8 @@

import mock

from nova.tests import fixtures
from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.image import fake


class CreateBackupSamplesJsonTest(test_servers.ServersSampleBase):
@@ -30,7 +30,7 @@ class CreateBackupSamplesJsonTest(test_servers.ServersSampleBase):
super(CreateBackupSamplesJsonTest, self).setUp()
self.uuid = self._post_server()

@mock.patch.object(fake._FakeImageService, 'detail', return_value=[])
@mock.patch.object(fixtures.GlanceFixture, 'detail', return_value=[])
def test_post_backup_server(self, mock_method):
# Get api samples to backup server request.
response = self._do_post('servers/%s/action' % self.uuid,


+ 6
- 7
nova/tests/functional/api_sample_tests/test_images.py View File

@@ -14,7 +14,6 @@
# under the License.

from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.image import fake


class ImagesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
@@ -27,7 +26,7 @@ class ImagesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):

def test_image_get(self):
# Get api sample of one single image details request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
response = self._do_get('images/%s' % image_id)
subs = {'image_id': image_id}
self._verify_response('image-get-resp', subs, response, 200)
@@ -39,14 +38,14 @@ class ImagesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):

def test_image_metadata_get(self):
# Get api sample of an image metadata request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
response = self._do_get('images/%s/metadata' % image_id)
subs = {'image_id': image_id}
self._verify_response('image-metadata-get-resp', subs, response, 200)

def test_image_metadata_post(self):
# Get api sample to update metadata of an image metadata request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
response = self._do_post(
'images/%s/metadata' % image_id,
'image-metadata-post-req', {})
@@ -54,21 +53,21 @@ class ImagesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):

def test_image_metadata_put(self):
# Get api sample of image metadata put request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
response = self._do_put('images/%s/metadata' %
(image_id), 'image-metadata-put-req', {})
self._verify_response('image-metadata-put-resp', {}, response, 200)

def test_image_meta_key_get(self):
# Get api sample of an image metadata key request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
key = "kernel_id"
response = self._do_get('images/%s/metadata/%s' % (image_id, key))
self._verify_response('image-meta-key-get', {}, response, 200)

def test_image_meta_key_put(self):
# Get api sample of image metadata key put request.
image_id = fake.get_valid_image_id()
image_id = self.glance.auto_disk_config_enabled_image['id']
key = "auto_disk_config"
response = self._do_put('images/%s/metadata/%s' % (image_id, key),
'image-meta-key-put-req', {})


+ 2
- 3
nova/tests/functional/api_sample_tests/test_multiple_create.py View File

@@ -14,7 +14,6 @@
# under the License.

from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.image import fake


class MultipleCreateJsonTest(test_servers.ServersSampleBase):
@@ -22,7 +21,7 @@ class MultipleCreateJsonTest(test_servers.ServersSampleBase):

def test_multiple_create(self):
subs = {
'image_id': fake.get_valid_image_id(),
'image_id': self.glance.auto_disk_config_enabled_image['id'],
'compute_endpoint': self._get_compute_endpoint(),
'min_count': "2",
'max_count': "3"
@@ -32,7 +31,7 @@ class MultipleCreateJsonTest(test_servers.ServersSampleBase):

def test_multiple_create_without_reservation_id(self):
subs = {
'image_id': fake.get_valid_image_id(),
'image_id': self.glance.auto_disk_config_enabled_image['id'],
'compute_endpoint': self._get_compute_endpoint(),
'min_count': "2",
'max_count': "3"


+ 1
- 3
nova/tests/functional/api_sample_tests/test_preserve_ephemeral_rebuild.py View File

@@ -14,7 +14,6 @@

from nova.compute import api as compute_api
from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.image import fake


class PreserveEphemeralOnRebuildJsonTest(test_servers.ServersSampleBase):
@@ -22,9 +21,8 @@ class PreserveEphemeralOnRebuildJsonTest(test_servers.ServersSampleBase):

def _test_server_rebuild_preserve_ephemeral(self, value, resp_tpl=None):
uuid = self._post_server()
image = fake.get_valid_image_id()
subs = {'host': self._get_host(),
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'pass': 'seekr3t',
'hostid': '[a-f0-9]+',


+ 11
- 22
nova/tests/functional/api_sample_tests/test_servers.py View File

@@ -25,7 +25,6 @@ import nova.conf
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.api.openstack import fakes
from nova.tests.unit.image import fake

CONF = nova.conf.CONF

@@ -61,7 +60,7 @@ class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21):
# common server sample files from 'servers' directory.
# Set False if tests need to use extension specific sample files
subs = {
'image_id': fake.get_valid_image_id(),
'image_id': self.glance.auto_disk_config_enabled_image['id'],
'host': self._get_host(),
'compute_endpoint': self._get_compute_endpoint(),
'versioned_compute_endpoint': self._get_vers_compute_endpoint(),
@@ -192,7 +191,7 @@ class ServersSampleJson219Test(ServersSampleJsonTest):
uuid = self.test_servers_post()
response = self._do_put('servers/%s' % uuid, 'server-put-req', {})
subs = {
'image_id': fake.get_valid_image_id(),
'image_id': self.glance.auto_disk_config_enabled_image['id'],
'hostid': '[a-f0-9]+',
'glance_host': self._get_glance_host(),
'access_ip_v4': '1.2.3.4',
@@ -235,9 +234,8 @@ class ServersSampleJson247Test(ServersSampleJsonTest):

def test_server_rebuild(self):
uuid = self._post_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'pass': 'seekr3t',
'hostid': '[a-f0-9]+',
@@ -284,10 +282,8 @@ class ServersSampleJson263Test(ServersSampleBase):
def test_server_rebuild(self):
uuid = self._post_server(use_common_server_api_samples=False)
fakes.stub_out_key_pair_funcs(self)
image = fake.get_valid_image_id()

params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'key_name': 'new-key',
'description': 'description of foobar',
@@ -484,9 +480,8 @@ class ServersSampleJson271Test(ServersSampleBase):
def test_servers_rebuild_with_server_groups(self):
uuid = self._test_servers_post()
fakes.stub_out_key_pair_funcs(self)
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'key_name': 'new-key',
'description': 'description of foobar',
@@ -558,9 +553,8 @@ class ServersSampleJson273Test(ServersSampleBase):

def test_server_rebuild_with_empty_locked_reason(self):
uuid = self._post_server(use_common_server_api_samples=False)
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'pass': 'seekr3t',
'hostid': '[a-f0-9]+',
@@ -647,9 +641,8 @@ class ServersSampleJson275Test(ServersUpdateSampleJsonTest):

def test_server_rebuild(self):
uuid = self._post_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'pass': 'seekr3t',
'hostid': '[a-f0-9]+',
@@ -711,9 +704,8 @@ class ServersActionsJsonTest(ServersSampleBase, _ServersActionsJsonTestMixin):

def test_server_rebuild(self):
uuid = self._post_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'pass': 'seekr3t',
'hostid': '[a-f0-9]+',
@@ -828,9 +820,8 @@ class ServersActionsJson219Test(ServersSampleBase):

def test_server_rebuild(self):
uuid = self._post_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'description': 'description of foobar',
'pass': 'seekr3t',
@@ -855,9 +846,8 @@ class ServersActionsJson226Test(ServersSampleBase):

def test_server_rebuild(self):
uuid = self._post_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'access_ip_v4': '1.2.3.4',
'access_ip_v6': '80fe::',
'disk_config': 'AUTO',
@@ -895,9 +885,8 @@ class ServersActionsJson254Test(ServersSampleBase):
def test_server_rebuild(self):
fakes.stub_out_key_pair_funcs(self)
uuid = self._create_server()
image = fake.get_valid_image_id()
params = {
'uuid': image,
'uuid': self.glance.auto_disk_config_enabled_image['id'],
'name': 'foobar',
'key_name': 'new-key',
'description': 'description of foobar',


+ 3
- 5
nova/tests/functional/compute/test_resource_tracker.py View File

@@ -33,7 +33,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
from nova.tests.unit.image import fake as fake_image
from nova.virt import driver as virt_driver


@@ -697,10 +696,9 @@ class TestProviderConfig(integrated_helpers.ProviderUsageBaseTestCase):
compute service that provides that trait.
"""

self.neutron = nova_fixtures.NeutronFixture(self)
self.useFixture(self.neutron)
fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))

# Start nova services.
self.api = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1')).admin_api


+ 2
- 11
nova/tests/functional/integrated_helpers.py View File

@@ -42,7 +42,6 @@ from nova.tests.functional.api import client as api_client
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.unit import cast_as_call
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
from nova import utils

@@ -1050,15 +1049,12 @@ class _IntegratedTestBase(test.TestCase, PlacementInstanceHelperMixin):
def setUp(self):
super(_IntegratedTestBase, self).setUp()

self.fake_image_service =\
nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.useFixture(cast_as_call.CastAsCall(self))

self.placement = self.useFixture(func_fixtures.PlacementFixture()).api
self.neutron = self.useFixture(nova_fixtures.NeutronFixture(self))
self.cinder = self.useFixture(nova_fixtures.CinderFixture(self))
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
self.policy = self.useFixture(policy_fixture.RealPolicyFixture())

fake_notifier.stub_notifier(self)
@@ -1128,6 +1124,7 @@ class ProviderUsageBaseTestCase(test.TestCase, PlacementInstanceHelperMixin):

self.policy = self.useFixture(policy_fixture.RealPolicyFixture())
self.neutron = self.useFixture(nova_fixtures.NeutronFixture(self))
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
self.placement = self.useFixture(func_fixtures.PlacementFixture()).api
self.useFixture(nova_fixtures.AllServicesCurrent())

@@ -1141,11 +1138,5 @@ class ProviderUsageBaseTestCase(test.TestCase, PlacementInstanceHelperMixin):
self.admin_api.microversion = self.microversion
self.api = self.admin_api

# the image fake backend needed for image discovery
self.image_service = (
nova.tests.unit.image.fake.stub_out_image_service(self))

self.start_service('conductor')
self.scheduler_service = self.start_service('scheduler')

self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

+ 2
- 7
nova/tests/functional/libvirt/test_evacuate.py View File

@@ -31,7 +31,6 @@ from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake as fake_image
from nova.tests.unit.virt.libvirt import fakelibvirt
from nova.virt.libvirt import config as libvirt_config

@@ -50,10 +49,8 @@ FLAVOR_FIXTURES = [
'root_gb': 1, 'ephemeral_gb': 0, 'swap': 1},
]


# Choice of image id is arbitrary, but fixed for consistency.
IMAGE_ID = fake_image.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID

IMAGE_ID = nova_fixtures.GlanceFixture.auto_disk_config_enabled_image['id']

# NOTE(mdbooth): Change I76448196 tests for creation of any local disk, and
# short-circuits as soon as it sees one created. Disks are created in order:
@@ -423,6 +420,7 @@ class _LibvirtEvacuateTest(integrated_helpers.InstanceHelperMixin):

self.useFixture(nova_fixtures.CinderFixture(self))
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
fake_network.set_stub_network_methods(self)

@@ -433,9 +431,6 @@ class _LibvirtEvacuateTest(integrated_helpers.InstanceHelperMixin):
# force_down and evacuate without onSharedStorage
self.api.microversion = '2.14'

fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)

fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)



+ 1
- 1
nova/tests/functional/libvirt/test_numa_servers.py View File

@@ -1251,7 +1251,7 @@ class NUMAServersRebuildTests(NUMAServersTestBase):
# 2 virtual numa nodes.
ctx = nova_context.get_admin_context()
image_meta = {'properties': {'hw_numa_nodes': 2}}
self.fake_image_service.update(ctx, self.image_ref_1, image_meta)
self.glance.update(ctx, self.image_ref_1, image_meta)

# NOTE(sean-k-mooney): this should fail because rebuild uses noop
# claims therefore it is not allowed for the NUMA topology or resource


+ 5
- 7
nova/tests/functional/libvirt/test_shared_resource_provider.py View File

@@ -19,7 +19,7 @@ import unittest
from nova.compute import instance_actions
from nova import conf
from nova.tests.functional.libvirt import integrated_helpers
import nova.tests.unit.image.fake
from nova import utils


CONF = conf.CONF
@@ -126,10 +126,9 @@ class SharedStorageProviderUsageTestCase(
networks='none'
)

rebuild_image_ref = (
nova.tests.unit.image.fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID)
rebuild_image_ref = self.glance.auto_disk_config_enabled_image['id']

with nova.utils.temporary_mutation(self.api, microversion='2.35'):
with utils.temporary_mutation(self.api, microversion='2.35'):
self.api.api_put('/images/%s/metadata' % rebuild_image_ref,
{'metadata': {
'trait:STORAGE_DISK_SSD': 'required'}})
@@ -185,10 +184,9 @@ class SharedStorageProviderUsageTestCase(
networks='none',
)

rebuild_image_ref = (
nova.tests.unit.image.fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID)
rebuild_image_ref = self.glance.auto_disk_config_enabled_image['id']

with nova.utils.temporary_mutation(self.api, microversion='2.35'):
with utils.temporary_mutation(self.api, microversion='2.35'):
self.api.api_put('/images/%s/metadata' % rebuild_image_ref,
{'metadata': {
'trait:CUSTOM_FOO': 'required'}})


+ 1
- 5
nova/tests/functional/notification_sample_tests/notification_sample_base.py View File

@@ -28,7 +28,6 @@ from nova.tests import json_ref
from nova.tests.unit.api.openstack.compute import test_services
from nova.tests.unit import fake_crypto
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake

CONF = cfg.CONF

@@ -80,10 +79,7 @@ class NotificationSampleTestBase(test.TestCase,
self.addCleanup(fake_notifier.reset)

self.useFixture(utils_fixture.TimeFixture(test_services.fake_utcnow()))

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())

context_patcher = self.mock_gen_request_id = mock.patch(


+ 1
- 7
nova/tests/functional/regressions/test_bug_1522536.py View File

@@ -12,13 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.

import nova.scheduler.utils
import nova.servicegroup
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -29,20 +26,17 @@ class TestServerGet(test.TestCase):
super(TestServerGet, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))

self.api = api_fixture.api

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)

self.start_service('conductor')
self.start_service('scheduler')
self.compute = self.start_service('compute')

self.useFixture(cast_as_call.CastAsCall(self))
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']


+ 3
- 8
nova/tests/functional/regressions/test_bug_1541691.py View File

@@ -12,12 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.

import nova.scheduler.utils
import nova.servicegroup
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -28,14 +25,12 @@ class TestServerValidation(test.TestCase):
def setUp(self):
super(TestServerValidation, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.GlanceFixture(self))

api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.api = api_fixture.api

self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']



+ 4
- 11
nova/tests/functional/regressions/test_bug_1548980.py View File

@@ -14,13 +14,10 @@

import time

import nova.scheduler.utils
import nova.servicegroup
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -31,27 +28,23 @@ class TestServerGet(test.TestCase):
super(TestServerGet, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(cast_as_call.CastAsCall(self))

# The non-admin API client is fine to stay at 2.1 since it just creates
# and deletes the server.
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
self.api = api_fixture.api
self.admin_api = api_fixture.admin_api
# The admin API client needs to be at microversion 2.16 to exhibit the
# regression.
self.admin_api.microversion = '2.16'

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)

self.start_service('conductor')
self.start_service('scheduler')
self.compute = self.start_service('compute')

self.useFixture(cast_as_call.CastAsCall(self))
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']



+ 2
- 6
nova/tests/functional/regressions/test_bug_1558866.py View File

@@ -17,7 +17,6 @@ import datetime
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client as api_client
from nova.tests.unit.image import fake as fake_image
from nova.tests.unit import policy_fixture


@@ -27,15 +26,12 @@ class TestServerGet(test.TestCase):
super(TestServerGet, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))

self.api = api_fixture.api

# the image fake backend needed for image discovery
image_service = fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)

# NOTE(mriedem): This image has an invalid architecture metadata value
# and is used for negative testing in the functional stack.
timestamp = datetime.datetime(2011, 1, 1, 1, 2, 3)
@@ -53,7 +49,7 @@ class TestServerGet(test.TestCase):
'properties': {'kernel_id': 'nokernel',
'ramdisk_id': 'nokernel',
'architecture': 'x64'}}
self.image_id = image_service.create(None, image)['id']
self.image_id = self.glance.create(None, image)['id']
self.flavor_id = self.api.get_flavors()[0]['id']

def test_boot_server_with_invalid_image_meta(self):


+ 1
- 6
nova/tests/functional/regressions/test_bug_1595962.py View File

@@ -18,7 +18,6 @@ import fixtures
import io
import mock

import nova
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
@@ -35,6 +34,7 @@ class TestSerialConsoleLiveMigrate(test.TestCase):
super(TestSerialConsoleLiveMigrate, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
@@ -53,10 +53,6 @@ class TestSerialConsoleLiveMigrate(test.TestCase):
self.admin_api = api_fixture.admin_api
self.api = api_fixture.api

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
nova.tests.unit.fake_network.set_stub_network_methods(self)

self.flags(compute_driver='libvirt.LibvirtDriver')
self.flags(enabled=True, group="serial_console")
self.flags(enabled=False, group="vnc")
@@ -68,7 +64,6 @@ class TestSerialConsoleLiveMigrate(test.TestCase):
self.compute = self.start_service('compute', host='test_compute1')

self.useFixture(cast_as_call.CastAsCall(self))
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']


+ 1
- 5
nova/tests/functional/regressions/test_bug_1620248.py View File

@@ -13,7 +13,6 @@
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -24,6 +23,7 @@ class TestServerUpdate(test.TestCase):
super(TestServerUpdate, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
# Simulate requests coming in before the instance is scheduled by
# using a no-op for conductor build_instances
self.useFixture(nova_fixtures.NoopConductorFixture())
@@ -32,11 +32,7 @@ class TestServerUpdate(test.TestCase):

self.api = api_fixture.api

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)

self.useFixture(cast_as_call.CastAsCall(self))
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']


+ 2
- 4
nova/tests/functional/regressions/test_bug_1670627.py View File

@@ -18,7 +18,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -50,13 +49,12 @@ class TestDeleteFromCell0CheckQuota(test.TestCase):
super(TestDeleteFromCell0CheckQuota, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))

api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
self.api = api_fixture.api

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)

self.start_service('conductor')
self.start_service('scheduler')



+ 3
- 5
nova/tests/functional/regressions/test_bug_1671648.py View File

@@ -14,14 +14,13 @@

import time

import nova.compute.resource_tracker
from nova.compute import resource_tracker
from nova import exception
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.unit import cast_as_call
from nova.tests.unit import fake_network
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -59,7 +58,7 @@ class TestRetryBetweenComputeNodeBuilds(test.TestCase):
self.admin_api = api_fixture.admin_api

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.useFixture(nova_fixtures.GlanceFixture(self))

self.start_service('conductor')

@@ -86,8 +85,7 @@ class TestRetryBetweenComputeNodeBuilds(test.TestCase):
# https://opendev.org/openstack/nova/src/commit/
# bb02d1110a9529217a5e9b1e1fe8ca25873cac59/
# nova/compute/resource_tracker.py#L121-L130
real_instance_claim =\
nova.compute.resource_tracker.ResourceTracker.instance_claim
real_instance_claim = resource_tracker.ResourceTracker.instance_claim

def fake_instance_claim(_self, *args, **kwargs):
self.attempts += 1


+ 2
- 3
nova/tests/functional/regressions/test_bug_1675570.py View File

@@ -21,7 +21,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture

LOG = logging.getLogger(__name__)
@@ -60,7 +59,7 @@ class TestLocalDeleteAttachedVolumes(test.TestCase):
self.api.microversion = 'latest'

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.useFixture(nova_fixtures.GlanceFixture(self))

self.start_service('conductor')
self.start_service('scheduler')
@@ -128,7 +127,7 @@ class TestLocalDeleteAttachedVolumes(test.TestCase):
LOG.info('Creating server and waiting for it to be ACTIVE.')
server = dict(
name='local-delete-volume-attach-test',
# The image ID comes from nova.tests.unit.image.fake.
# The image ID comes from GlanceFixture
imageRef='76fa36fc-c930-4bf3-8c8a-ea2a2420deb6',
flavorRef=self.flavor_id,
# Bypass network setup on the compute.


+ 1
- 3
nova/tests/functional/regressions/test_bug_1679750.py View File

@@ -19,7 +19,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -30,14 +29,13 @@ class TestLocalDeleteAllocations(test.TestCase,
self.useFixture(policy_fixture.RealPolicyFixture())
# The NeutronFixture is needed to show security groups for a server.
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))
self.api = api_fixture.api
self.admin_api = api_fixture.admin_api
# We need the latest microversion to force-down the compute service
self.admin_api.microversion = 'latest'
# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)

self.start_service('conductor')



+ 1
- 3
nova/tests/functional/regressions/test_bug_1682693.py View File

@@ -16,7 +16,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as image_fake
from nova.tests.unit import policy_fixture


@@ -41,8 +40,7 @@ class ServerTagsFilteringTest(test.TestCase,
self.api = api_fixture.api

# the image fake backend needed for image discovery
image_fake.stub_out_image_service(self)
self.addCleanup(image_fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))

# Use the latest microversion available to make sure something does
# not regress in new microversions; cap as necessary.


+ 1
- 3
nova/tests/functional/regressions/test_bug_1689692.py View File

@@ -16,7 +16,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import cast_as_call
from nova.tests.unit.image import fake as image_fake
from nova.tests.unit import policy_fixture


@@ -42,8 +41,7 @@ class ServerListLimitMarkerCell0Test(test.TestCase,
self.api = api_fixture.api

# the image fake backend needed for image discovery
image_fake.stub_out_image_service(self)
self.addCleanup(image_fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))

# Use the latest microversion available to make sure something does
# not regress in new microversions; cap as necessary.


+ 1
- 3
nova/tests/functional/regressions/test_bug_1702454.py View File

@@ -15,7 +15,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import cast_as_call
from nova.tests.unit.image import fake as image_fake
from nova.tests.unit import policy_fixture


@@ -59,8 +58,7 @@ class SchedulerOnlyChecksTargetTest(test.TestCase,
self.api = api_fixture.api

# the image fake backend needed for image discovery
image_fake.stub_out_image_service(self)
self.addCleanup(image_fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))

self.start_service('conductor')



+ 1
- 5
nova/tests/functional/regressions/test_bug_1713783.py View File

@@ -22,7 +22,6 @@ from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -47,6 +46,7 @@ class FailedEvacuateStateTests(test.TestCase,

self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())

api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
@@ -55,13 +55,9 @@ class FailedEvacuateStateTests(test.TestCase,
self.api = api_fixture.admin_api
self.api.microversion = self.microversion

nova.tests.unit.image.fake.stub_out_image_service(self)

self.start_service('conductor')
self.start_service('scheduler')

self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.hostname = 'host1'
self.compute1 = self.start_service('compute', host=self.hostname)
fake_network.set_stub_network_methods(self)


+ 1
- 4
nova/tests/functional/regressions/test_bug_1718455.py View File

@@ -17,7 +17,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -46,6 +45,7 @@ class TestLiveMigrateOneOfConcurrentlyCreatedInstances(

self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())

api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
@@ -54,9 +54,6 @@ class TestLiveMigrateOneOfConcurrentlyCreatedInstances(
self.api = api_fixture.admin_api
self.api.microversion = self.microversion

nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.start_service('conductor')
self.start_service('scheduler')



+ 1
- 3
nova/tests/functional/regressions/test_bug_1718512.py View File

@@ -17,7 +17,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as image_fake
from nova.tests.unit import policy_fixture


@@ -52,8 +51,7 @@ class TestRequestSpecRetryReschedule(test.TestCase,
self.api = api_fixture.api

# the image fake backend needed for image discovery
image_fake.stub_out_image_service(self)
self.addCleanup(image_fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))

self.start_service('conductor')



+ 1
- 3
nova/tests/functional/regressions/test_bug_1719730.py View File

@@ -16,7 +16,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -56,8 +55,7 @@ class TestRescheduleWithServerGroup(test.TestCase,
self.admin_api = api_fixture.admin_api

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))

self.start_service('conductor')
self.start_service('scheduler')


+ 3
- 4
nova/tests/functional/regressions/test_bug_1735407.py View File

@@ -10,13 +10,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from nova.compute import manager
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -52,8 +52,7 @@ class TestParallelEvacuationWithServerGroup(
self.addCleanup(fake_notifier.reset)

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))

self.start_service('conductor')
self.start_service('scheduler')
@@ -66,7 +65,7 @@ class TestParallelEvacuationWithServerGroup(
self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']

manager_class = nova.compute.manager.ComputeManager
manager_class = manager.ComputeManager
original_rebuild = manager_class._do_rebuild_instance

def fake_rebuild(self_, context, instance, *args, **kwargs):


+ 1
- 4
nova/tests/functional/regressions/test_bug_1741307.py View File

@@ -14,7 +14,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -47,6 +46,7 @@ class TestResizeWithNoAllocationScheduler(
super(TestResizeWithNoAllocationScheduler, self).setUp()

self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(func_fixtures.PlacementFixture())

@@ -56,9 +56,6 @@ class TestResizeWithNoAllocationScheduler(
self.api = api_fixture.admin_api
self.api.microversion = self.microversion

nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.start_service('conductor')

# Create two compute nodes/services.


+ 2
- 5
nova/tests/functional/regressions/test_bug_1746483.py View File

@@ -15,7 +15,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as image_fakes
from nova.tests.unit import policy_fixture
from nova import utils

@@ -39,6 +38,7 @@ class TestBootFromVolumeIsolatedHostsFilter(

self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(nova_fixtures.CinderFixture(self))
self.useFixture(func_fixtures.PlacementFixture())

@@ -47,9 +47,6 @@ class TestBootFromVolumeIsolatedHostsFilter(

self.api = api_fixture.admin_api

image_fakes.stub_out_image_service(self)
self.addCleanup(image_fakes.FakeImageService_reset)

self.start_service('conductor')

# Add the IsolatedHostsFilter to the list of enabled filters since it
@@ -58,7 +55,7 @@ class TestBootFromVolumeIsolatedHostsFilter(
enabled_filters.append('IsolatedHostsFilter')
self.flags(
enabled_filters=enabled_filters,
isolated_images=[image_fakes.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID],
isolated_images=[self.glance.auto_disk_config_enabled_image['id']],
isolated_hosts=['host1'],
restrict_isolated_hosts_to_isolated_images=True,
group='filter_scheduler')


+ 1
- 3
nova/tests/functional/regressions/test_bug_1764556.py View File

@@ -16,7 +16,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as fake_image
from nova.tests.unit import policy_fixture
from nova import utils

@@ -49,8 +48,7 @@ class InstanceListWithDeletedServicesTestCase(
self.admin_api.microversion = 'latest'

# the image fake backend needed for image discovery
fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))

self.api.microversion = 'latest'



+ 3
- 5
nova/tests/functional/regressions/test_bug_1764883.py View File

@@ -10,14 +10,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from nova.compute import manager
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -53,8 +52,7 @@ class TestEvacuationWithSourceReturningDuringRebuild(
self.api.microversion = '2.14'

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
self.useFixture(nova_fixtures.GlanceFixture(self))

self.start_service('conductor')
self.start_service('scheduler')
@@ -71,7 +69,7 @@ class TestEvacuationWithSourceReturningDuringRebuild(
# Stub out rebuild with a slower method allowing the src compute to be
# restarted once the migration hits pre-migrating after claiming
# resources on the dest.
manager_class = nova.compute.manager.ComputeManager
manager_class = manager.ComputeManager
original_rebuild = manager_class._do_rebuild_instance

def start_src_rebuild(self_, context, instance, *args, **kwargs):


+ 3
- 10
nova/tests/functional/regressions/test_bug_1780373.py View File

@@ -14,7 +14,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as fake_image
from nova.tests.unit import policy_fixture


@@ -41,6 +40,7 @@ class TestMultiCreateServerGroupMemberOverQuota(
self.flags(server_group_members=2, group='quota')
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())

api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
@@ -48,9 +48,6 @@ class TestMultiCreateServerGroupMemberOverQuota(
self.api = api_fixture.api
self.api.microversion = '2.37' # so we can specify networks='none'

fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)

group = {'name': 'test group', 'policies': ['soft-anti-affinity']}
self.created_group = self.api.post_server_groups(group)

@@ -59,9 +56,7 @@ class TestMultiCreateServerGroupMemberOverQuota(
server group and then create 3 servers in the group using a
multi-create POST /servers request.
"""
server_req = self._build_server(
image_uuid=fake_image.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID,
networks='none')
server_req = self._build_server(networks='none')
server_req['min_count'] = 3
server_req['return_reservation_id'] = True
hints = {'group': self.created_group['id']}
@@ -86,9 +81,7 @@ class TestMultiCreateServerGroupMemberOverQuota(
# by using NoopConductorFixture.
self.useFixture(nova_fixtures.NoopConductorFixture())
for x in range(3):
server_req = self._build_server(
image_uuid=fake_image.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID,
networks='none')
server_req = self._build_server(networks='none')
hints = {'group': self.created_group['id']}
# This should result in a 403 response on the 3rd server.
if x == 2:


+ 3
- 5
nova/tests/functional/regressions/test_bug_1781286.py View File

@@ -21,7 +21,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
from nova.tests.unit.image import fake as fake_image
from nova.tests.unit import policy_fixture


@@ -39,10 +38,10 @@ class RescheduleBuildAvailabilityZoneUpCall(
super(RescheduleBuildAvailabilityZoneUpCall, self).setUp()
# Use the standard fixtures.
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)

# Start controller services.
self.api = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1')).admin_api
@@ -103,10 +102,9 @@ class RescheduleMigrateAvailabilityZoneUpCall(
super(RescheduleMigrateAvailabilityZoneUpCall, self).setUp()
# Use the standard fixtures.
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)
# Start controller services.
self.api = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1')).admin_api


+ 2
- 7
nova/tests/functional/regressions/test_bug_1781710.py View File

@@ -15,7 +15,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as image_fake
from nova.tests.unit import policy_fixture


@@ -40,6 +39,7 @@ class AntiAffinityMultiCreateRequest(test.TestCase,
def setUp(self):
super(AntiAffinityMultiCreateRequest, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(func_fixtures.PlacementFixture())

@@ -50,9 +50,6 @@ class AntiAffinityMultiCreateRequest(test.TestCase,
self.admin_api = api_fixture.admin_api
self.api = api_fixture.api

image_fake.stub_out_image_service(self)
self.addCleanup(image_fake.FakeImageService_reset)

self.start_service('conductor')

# Use the latest microversion available to make sure something does
@@ -102,9 +99,7 @@ class AntiAffinityMultiCreateRequest(test.TestCase,
'_get_alternate_hosts', stub_get_alternate_hosts)

# Now create two servers in that group.
server_req = self._build_server(
image_uuid=image_fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID,
networks='none')
server_req = self._build_server(networks='none')
server_req['min_count'] = 2
self.api.api_post(
'/servers', {'server': server_req,


+ 2
- 6
nova/tests/functional/regressions/test_bug_1784353.py View File

@@ -15,7 +15,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture


@@ -32,10 +31,10 @@ class TestRescheduleWithVolumesAttached(
super(TestRescheduleWithVolumesAttached, self).setUp()

# Use the new attach flow fixture for cinder
cinder_fixture = nova_fixtures.CinderFixture(self)
self.cinder = self.useFixture(cinder_fixture)
self.cinder = self.useFixture(nova_fixtures.CinderFixture(self))
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))

fake_network.set_stub_network_methods(self)

@@ -45,9 +44,6 @@ class TestRescheduleWithVolumesAttached(
api_version='v2.1'))
self.api = api_fixture.admin_api

nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.flags(compute_driver='fake.FakeRescheduleDriver')

self.start_service('conductor')


+ 2
- 7
nova/tests/functional/regressions/test_bug_1797580.py View File

@@ -14,7 +14,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as image_fake
from nova.tests.unit import policy_fixture


@@ -40,6 +39,7 @@ class ColdMigrateTargetHostThenLiveMigrateTest(
super(ColdMigrateTargetHostThenLiveMigrateTest, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())

api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
@@ -53,9 +53,6 @@ class ColdMigrateTargetHostThenLiveMigrateTest(
self.admin_api.microversion = 'latest'
self.api.microversion = 'latest'

image_fake.stub_out_image_service(self)
self.addCleanup(image_fake.FakeImageService_reset)

self.start_service('conductor')
self.start_service('scheduler')

@@ -64,9 +61,7 @@ class ColdMigrateTargetHostThenLiveMigrateTest(

def test_cold_migrate_target_host_then_live_migrate(self):
# Create a server, it doesn't matter on which host it builds.
server = self._build_server(
image_uuid=image_fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID,
networks='none')
server = self._build_server(networks='none')
server = self.api.post_server({'server': server})
server = self._wait_for_state_change(server, 'ACTIVE')
original_host = server['OS-EXT-SRV-ATTR:host']


+ 1
- 5
nova/tests/functional/regressions/test_bug_1806515.py View File

@@ -14,7 +14,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
import nova.tests.unit.image.fake


class ShowErrorServerWithTags(test.TestCase,
@@ -33,14 +32,11 @@ class ShowErrorServerWithTags(test.TestCase,
self.api = api_fixture.admin_api

self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))

self.start_service('conductor')
self.start_service('scheduler')

# the image fake backend needed for image discovery
nova.tests.unit.image.fake.stub_out_image_service(self)
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)

self.image_id = self.api.get_images()[0]['id']

self.api.microversion = 'latest'


+ 1
- 4
nova/tests/functional/regressions/test_bug_1815153.py View File

@@ -19,7 +19,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as image_fake
from nova.tests.unit import policy_fixture


@@ -49,6 +48,7 @@ class NonPersistentFieldNotResetTest(
super(NonPersistentFieldNotResetTest, self).setUp()
self.useFixture(policy_fixture.RealPolicyFixture())
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())

api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
@@ -58,9 +58,6 @@ class NonPersistentFieldNotResetTest(
# not regress in new microversions; cap as necessary.
self.api.microversion = 'latest'

image_fake.stub_out_image_service(self)
self.addCleanup(image_fake.FakeImageService_reset)

self.start_service('conductor')
self.start_service('scheduler')



+ 1
- 3
nova/tests/functional/regressions/test_bug_1825020.py View File

@@ -14,7 +14,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as fake_image


class VolumeBackedResizeDiskDown(test.TestCase,
@@ -36,10 +35,9 @@ class VolumeBackedResizeDiskDown(test.TestCase,
self.api = api_fixture.admin_api

self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(nova_fixtures.CinderFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)

self.start_service('conductor')
self.start_service('scheduler')


+ 1
- 4
nova/tests/functional/regressions/test_bug_1825034.py View File

@@ -17,7 +17,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as fake_image


class FillVirtualInterfaceListMigration(
@@ -38,13 +37,11 @@ class FillVirtualInterfaceListMigration(
api_version='v2.1'))
self.api = api_fixture.admin_api
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(nova_fixtures.GlanceFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
self.start_service('conductor')
self.start_service('scheduler')
self.start_service('compute')
# the image fake backend needed for image discovery
fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)

def test_fill_vifs_migration(self):
# Create a test server.


+ 1
- 3
nova/tests/functional/regressions/test_bug_1830747.py View File

@@ -19,7 +19,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as fake_image


class MissingReqSpecInstanceGroupUUIDTestCase(
@@ -51,9 +50,8 @@ class MissingReqSpecInstanceGroupUUIDTestCase(
super(MissingReqSpecInstanceGroupUUIDTestCase, self).setUp()
# Stub out external dependencies.
self.useFixture(nova_fixtures.NeutronFixture(self))