Merge "Novaclient v2 instead of v1_1"

This commit is contained in:
Jenkins 2015-04-08 06:32:09 +00:00 committed by Gerrit Code Review
commit b4a0ee8baf
32 changed files with 122 additions and 117 deletions

View File

@ -16,7 +16,6 @@ include heat/db/sqlalchemy/migrate_repo/README
include heat/openstack/common/README include heat/openstack/common/README
include heat/tests/examples/tags.txt include heat/tests/examples/tags.txt
include heat/tests/testing-overview.txt include heat/tests/testing-overview.txt
include heat/tests/v1_1/testfile.txt
include heat/tests/policy/deny_stack_user.json include heat/tests/policy/deny_stack_user.json
include heat/tests/policy/notallowed.json include heat/tests/policy/notallowed.json
graft contrib graft contrib

View File

@ -17,8 +17,8 @@ from heat.engine import parser
from heat.engine import resource from heat.engine import resource
from heat.engine import template from heat.engine import template
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes
from ..resources import nova_flavor # noqa from ..resources import nova_flavor # noqa

View File

@ -25,8 +25,8 @@ from heat.engine import resource
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import template from heat.engine import template
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes
from ..resources import cloud_server # noqa from ..resources import cloud_server # noqa

View File

@ -20,9 +20,9 @@ import os
import pkgutil import pkgutil
import string import string
from novaclient import client as nc
from novaclient import exceptions from novaclient import exceptions
from novaclient import shell as novashell from novaclient import shell as novashell
from novaclient.v2 import client as nc
from oslo_config import cfg from oslo_config import cfg
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
@ -39,6 +39,9 @@ from heat.engine import scheduler
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
NOVACLIENT_VERSION = "2"
class NovaClientPlugin(client_plugin.ClientPlugin): class NovaClientPlugin(client_plugin.ClientPlugin):
deferred_server_statuses = ['BUILD', deferred_server_statuses = ['BUILD',
@ -55,10 +58,13 @@ class NovaClientPlugin(client_plugin.ClientPlugin):
exceptions_module = exceptions exceptions_module = exceptions
def _create(self): def _create(self):
computeshell = novashell.OpenStackComputeShell()
extensions = computeshell._discover_extensions("1.1")
endpoint_type = self._get_client_option('nova', 'endpoint_type') endpoint_type = self._get_client_option('nova', 'endpoint_type')
management_url = self.url_for(service_type='compute',
endpoint_type=endpoint_type)
computeshell = novashell.OpenStackComputeShell()
extensions = computeshell._discover_extensions(NOVACLIENT_VERSION)
args = { args = {
'project_id': self.context.tenant, 'project_id': self.context.tenant,
'auth_url': self.context.auth_url, 'auth_url': self.context.auth_url,
@ -73,10 +79,7 @@ class NovaClientPlugin(client_plugin.ClientPlugin):
'insecure': self._get_client_option('nova', 'insecure') 'insecure': self._get_client_option('nova', 'insecure')
} }
client = nc.Client(1.1, **args) client = nc.Client(**args)
management_url = self.url_for(service_type='compute',
endpoint_type=endpoint_type)
client.client.auth_token = self.auth_token client.client.auth_token = self.auth_token
client.client.management_url = management_url client.client.management_url = management_url

View File

@ -26,8 +26,8 @@ from heat.engine import rsrc_defn
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests.autoscaling import inline_templates from heat.tests.autoscaling import inline_templates
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
as_template = inline_templates.as_template as_template = inline_templates.as_template
@ -520,7 +520,7 @@ def asg_tmpl_with_updt_policy():
class RollingUpdatePolicyTest(common.HeatTestCase): class RollingUpdatePolicyTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(RollingUpdatePolicyTest, self).setUp() super(RollingUpdatePolicyTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.stub_keystoneclient(username='test_stack.CfnLBUser') self.stub_keystoneclient(username='test_stack.CfnLBUser')
self.stub_ImageConstraint_validate() self.stub_ImageConstraint_validate()
self.stub_FlavorConstraint_validate() self.stub_FlavorConstraint_validate()
@ -590,7 +590,7 @@ class RollingUpdatePolicyTest(common.HeatTestCase):
class RollingUpdatePolicyDiffTest(common.HeatTestCase): class RollingUpdatePolicyDiffTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(RollingUpdatePolicyDiffTest, self).setUp() super(RollingUpdatePolicyDiffTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.stub_keystoneclient(username='test_stack.CfnLBUser') self.stub_keystoneclient(username='test_stack.CfnLBUser')
cfg.CONF.set_default('heat_waitcondition_server_url', cfg.CONF.set_default('heat_waitcondition_server_url',
'http://127.0.0.1:8000/v1/waitcondition') 'http://127.0.0.1:8000/v1/waitcondition')

View File

@ -27,9 +27,9 @@ from heat.engine.resources.aws.ec2 import instance
from heat.engine.resources.aws.ec2 import volume as aws_vol from heat.engine.resources.aws.ec2 import volume as aws_vol
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests.nova import fakes as fakes_nova
from heat.tests import test_volume_utils as vt_base from heat.tests import test_volume_utils as vt_base
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
volume_template = ''' volume_template = '''
@ -251,7 +251,7 @@ class VolumeTest(vt_base.BaseVolumeTest):
self.fc.volumes.get_server_volume(u'WikiDatabase', self.fc.volumes.get_server_volume(u'WikiDatabase',
'vol-123').AndReturn(fva) 'vol-123').AndReturn(fva)
self.fc.volumes.get_server_volume( self.fc.volumes.get_server_volume(
u'WikiDatabase', 'vol-123').AndRaise(fakes_v1_1.fake_exception()) u'WikiDatabase', 'vol-123').AndRaise(fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()
@ -279,13 +279,13 @@ class VolumeTest(vt_base.BaseVolumeTest):
self.cinder_fc.volumes.get(fva.id).AndReturn(fva) self.cinder_fc.volumes.get(fva.id).AndReturn(fva)
self.fc.volumes.delete_server_volume( self.fc.volumes.delete_server_volume(
'WikiDatabase', 'vol-123').AndRaise(fakes_v1_1.fake_exception(400)) 'WikiDatabase', 'vol-123').AndRaise(fakes_nova.fake_exception(400))
self.cinder_fc.volumes.get(fva.id).AndReturn( self.cinder_fc.volumes.get(fva.id).AndReturn(
vt_base.FakeVolume('available', id=fva.id)) vt_base.FakeVolume('available', id=fva.id))
self.fc.volumes.get_server_volume(u'WikiDatabase', self.fc.volumes.get_server_volume(u'WikiDatabase',
'vol-123').AndReturn(fva) 'vol-123').AndReturn(fva)
self.fc.volumes.get_server_volume( self.fc.volumes.get_server_volume(
u'WikiDatabase', 'vol-123').AndRaise(fakes_v1_1.fake_exception()) u'WikiDatabase', 'vol-123').AndRaise(fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()
stack = utils.parse_stack(self.t, stack_name=stack_name) stack = utils.parse_stack(self.t, stack_name=stack_name)
@ -370,7 +370,7 @@ class VolumeTest(vt_base.BaseVolumeTest):
self.fc.volumes.get_server_volume(u'WikiDatabase', self.fc.volumes.get_server_volume(u'WikiDatabase',
'vol-123').AndReturn(fva) 'vol-123').AndReturn(fva)
self.fc.volumes.get_server_volume( self.fc.volumes.get_server_volume(
u'WikiDatabase', 'vol-123').AndRaise(fakes_v1_1.fake_exception()) u'WikiDatabase', 'vol-123').AndRaise(fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()

View File

@ -32,8 +32,8 @@ from heat.engine import resource as rsrc
from heat.engine.resources.aws.ec2 import instance as instances from heat.engine.resources.aws.ec2 import instance as instances
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
wp_template = ''' wp_template = '''
@ -86,7 +86,7 @@ class MyResource(rsrc.Resource):
class SqlAlchemyTest(common.HeatTestCase): class SqlAlchemyTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(SqlAlchemyTest, self).setUp() super(SqlAlchemyTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.ctx = utils.dummy_context() self.ctx = utils.dummy_context()
def tearDown(self): def tearDown(self):
@ -111,7 +111,7 @@ class SqlAlchemyTest(common.HeatTestCase):
return (template, stack) return (template, stack)
def _mock_create(self, mocks): def _mock_create(self, mocks):
fc = fakes_v1_1.FakeClient() fc = fakes_nova.FakeClient()
mocks.StubOutWithMock(instances.Instance, 'nova') mocks.StubOutWithMock(instances.Instance, 'nova')
instances.Instance.nova().MultipleTimes().AndReturn(fc) instances.Instance.nova().MultipleTimes().AndReturn(fc)
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create') self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
@ -130,12 +130,12 @@ class SqlAlchemyTest(common.HeatTestCase):
return fc return fc
def _mock_delete(self, mocks): def _mock_delete(self, mocks):
fc = fakes_v1_1.FakeClient() fc = fakes_nova.FakeClient()
mocks.StubOutWithMock(instances.Instance, 'nova') mocks.StubOutWithMock(instances.Instance, 'nova')
instances.Instance.nova().MultipleTimes().AndReturn(fc) instances.Instance.nova().MultipleTimes().AndReturn(fc)
mocks.StubOutWithMock(fc.client, 'get_servers_9999') mocks.StubOutWithMock(fc.client, 'get_servers_9999')
get = fc.client.get_servers_9999 get = fc.client.get_servers_9999
get().MultipleTimes().AndRaise(fakes_v1_1.fake_exception()) get().MultipleTimes().AndRaise(fakes_nova.fake_exception())
@mock.patch.object(db_api, '_paginate_query') @mock.patch.object(db_api, '_paginate_query')
def test_filter_and_page_query_paginates_query(self, mock_paginate_query): def test_filter_and_page_query_paginates_query(self, mock_paginate_query):

View File

@ -27,8 +27,8 @@ from heat.engine.clients.os import nova
from heat.engine.resources.openstack.neutron import loadbalancer from heat.engine.resources.openstack.neutron import loadbalancer
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
health_monitor_template = ''' health_monitor_template = '''
@ -847,7 +847,7 @@ class PoolMemberTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(PoolMemberTest, self).setUp() super(PoolMemberTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.m.StubOutWithMock(neutronclient.Client, 'create_member') self.m.StubOutWithMock(neutronclient.Client, 'create_member')
self.m.StubOutWithMock(neutronclient.Client, 'delete_member') self.m.StubOutWithMock(neutronclient.Client, 'delete_member')
self.m.StubOutWithMock(neutronclient.Client, 'update_member') self.m.StubOutWithMock(neutronclient.Client, 'update_member')
@ -948,7 +948,7 @@ class LoadBalancerTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(LoadBalancerTest, self).setUp() super(LoadBalancerTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.m.StubOutWithMock(neutronclient.Client, 'create_member') self.m.StubOutWithMock(neutronclient.Client, 'create_member')
self.m.StubOutWithMock(neutronclient.Client, 'delete_member') self.m.StubOutWithMock(neutronclient.Client, 'delete_member')
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create') self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')

View File

@ -13,8 +13,8 @@
from neutronclient.common import exceptions as neutron_exc from neutronclient.common import exceptions as neutron_exc
from neutronclient.v2_0 import client as neutronclient from neutronclient.v2_0 import client as neutronclient
from novaclient.v1_1 import security_group_rules as nova_sgr from novaclient.v2 import security_group_rules as nova_sgr
from novaclient.v1_1 import security_groups as nova_sg from novaclient.v2 import security_groups as nova_sg
from heat.common import exception from heat.common import exception
from heat.common import template_format from heat.common import template_format
@ -22,8 +22,8 @@ from heat.engine import parser
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import template from heat.engine import template
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
class SecurityGroupTest(common.HeatTestCase): class SecurityGroupTest(common.HeatTestCase):
@ -85,7 +85,7 @@ Resources:
def setUp(self): def setUp(self):
super(SecurityGroupTest, self).setUp() super(SecurityGroupTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'create') self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'create')
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'delete') self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'delete')
self.m.StubOutWithMock(nova_sg.SecurityGroupManager, 'create') self.m.StubOutWithMock(nova_sg.SecurityGroupManager, 'create')

View File

@ -17,13 +17,17 @@
import mock import mock
from novaclient import client as base_client from novaclient import client as base_client
from novaclient import exceptions as nova_exceptions from novaclient import exceptions as nova_exceptions
from novaclient.v1_1 import client
import requests import requests
from six.moves.urllib import parse as urlparse from six.moves.urllib import parse as urlparse
from heat.tests import fakes from heat.tests import fakes
NOVACLIENT_VERSION = "2"
Client = base_client.get_client_class(NOVACLIENT_VERSION)
def fake_exception(status_code=404, message=None, details=None): def fake_exception(status_code=404, message=None, details=None):
resp = mock.Mock() resp = mock.Mock()
resp.status_code = status_code resp.status_code = status_code
@ -32,11 +36,11 @@ def fake_exception(status_code=404, message=None, details=None):
return nova_exceptions.from_response(resp, body, None) return nova_exceptions.from_response(resp, body, None)
class FakeClient(fakes.FakeClient, client.Client): class FakeClient(fakes.FakeClient, Client):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
client.Client.__init__(self, 'username', 'password', super(FakeClient, self).__init__('username', 'password', 'project_id',
'project_id', 'auth_url') 'auth_url')
self.client = FakeHTTPClient(**kwargs) self.client = FakeHTTPClient(**kwargs)

View File

@ -25,9 +25,9 @@ from heat.engine.clients.os import glance
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.engine import scheduler from heat.engine import scheduler
from heat.objects import resource_data as resource_data_object from heat.objects import resource_data as resource_data_object
from heat.tests.nova import fakes as fakes_nova
from heat.tests import test_volume_utils as vt_base from heat.tests import test_volume_utils as vt_base
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
cinder_volume_template = ''' cinder_volume_template = '''
heat_template_version: 2013-05-23 heat_template_version: 2013-05-23
@ -265,7 +265,7 @@ class CinderVolumeTest(vt_base.BaseVolumeTest):
self.fc.volumes.get_server_volume(u'WikiDatabase', self.fc.volumes.get_server_volume(u'WikiDatabase',
'vol-123').AndReturn(fva) 'vol-123').AndReturn(fva)
self.fc.volumes.get_server_volume( self.fc.volumes.get_server_volume(
u'WikiDatabase', 'vol-123').AndRaise(fakes_v1_1.fake_exception()) u'WikiDatabase', 'vol-123').AndRaise(fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()
@ -431,7 +431,7 @@ class CinderVolumeTest(vt_base.BaseVolumeTest):
self.fc.volumes.get_server_volume(u'WikiDatabase', self.fc.volumes.get_server_volume(u'WikiDatabase',
'vol-123').AndReturn(fvd) 'vol-123').AndReturn(fvd)
self.fc.volumes.get_server_volume( self.fc.volumes.get_server_volume(
u'WikiDatabase', 'vol-123').AndRaise(fakes_v1_1.fake_exception()) u'WikiDatabase', 'vol-123').AndRaise(fakes_nova.fake_exception())
# resize script # resize script
self.cinder_fc.volumes.extend(fvd.id, 2) self.cinder_fc.volumes.extend(fvd.id, 2)
@ -671,7 +671,7 @@ class CinderVolumeTest(vt_base.BaseVolumeTest):
self.fc.volumes.get_server_volume(u'WikiDatabase', self.fc.volumes.get_server_volume(u'WikiDatabase',
'vol-123').AndReturn(fva) 'vol-123').AndReturn(fva)
self.fc.volumes.get_server_volume( self.fc.volumes.get_server_volume(
u'WikiDatabase', 'vol-123').AndRaise(fakes_v1_1.fake_exception()) u'WikiDatabase', 'vol-123').AndRaise(fakes_nova.fake_exception())
# attach script # attach script
self._mock_create_server_volume_script(vt_base.FakeVolume('attaching'), self._mock_create_server_volume_script(vt_base.FakeVolume('attaching'),
@ -724,7 +724,7 @@ class CinderVolumeTest(vt_base.BaseVolumeTest):
self.fc.volumes.get_server_volume(u'WikiDatabase', self.fc.volumes.get_server_volume(u'WikiDatabase',
'vol-123').AndReturn(fva) 'vol-123').AndReturn(fva)
self.fc.volumes.get_server_volume( self.fc.volumes.get_server_volume(
u'WikiDatabase', 'vol-123').AndRaise(fakes_v1_1.fake_exception()) u'WikiDatabase', 'vol-123').AndRaise(fakes_nova.fake_exception())
# attach script # attach script
fv2a = vt_base.FakeVolume('attaching', id='vol-456') fv2a = vt_base.FakeVolume('attaching', id='vol-456')
@ -770,7 +770,7 @@ class CinderVolumeTest(vt_base.BaseVolumeTest):
self.fc.volumes.get_server_volume(u'WikiDatabase', self.fc.volumes.get_server_volume(u'WikiDatabase',
'vol-123').AndReturn(fva) 'vol-123').AndReturn(fva)
self.fc.volumes.get_server_volume( self.fc.volumes.get_server_volume(
u'WikiDatabase', 'vol-123').AndRaise(fakes_v1_1.fake_exception()) u'WikiDatabase', 'vol-123').AndRaise(fakes_nova.fake_exception())
# attach script # attach script
self._mock_create_server_volume_script(vt_base.FakeVolume('attaching'), self._mock_create_server_volume_script(vt_base.FakeVolume('attaching'),

View File

@ -34,8 +34,8 @@ from heat.engine import clients
from heat.engine.clients import client_plugin from heat.engine.clients import client_plugin
from heat.tests import common from heat.tests import common
from heat.tests import fakes from heat.tests import fakes
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
class ClientsTest(common.HeatTestCase): class ClientsTest(common.HeatTestCase):
@ -509,7 +509,7 @@ class TestIsNotFound(common.HeatTestCase):
is_conflict=False, is_conflict=False,
is_unprocessable_entity=False, is_unprocessable_entity=False,
plugin='nova', plugin='nova',
exception=lambda: fakes_v1_1.fake_exception(), exception=lambda: fakes_nova.fake_exception(),
)), )),
('nova_exception', dict( ('nova_exception', dict(
is_not_found=False, is_not_found=False,
@ -527,7 +527,7 @@ class TestIsNotFound(common.HeatTestCase):
is_conflict=False, is_conflict=False,
is_unprocessable_entity=False, is_unprocessable_entity=False,
plugin='nova', plugin='nova',
exception=lambda: fakes_v1_1.fake_exception(413), exception=lambda: fakes_nova.fake_exception(413),
)), )),
('nova_unprocessable_entity', dict( ('nova_unprocessable_entity', dict(
is_not_found=False, is_not_found=False,
@ -536,7 +536,7 @@ class TestIsNotFound(common.HeatTestCase):
is_conflict=False, is_conflict=False,
is_unprocessable_entity=True, is_unprocessable_entity=True,
plugin='nova', plugin='nova',
exception=lambda: fakes_v1_1.fake_exception(422), exception=lambda: fakes_nova.fake_exception(422),
)), )),
('nova_conflict', dict( ('nova_conflict', dict(
is_not_found=False, is_not_found=False,
@ -545,7 +545,7 @@ class TestIsNotFound(common.HeatTestCase):
is_conflict=True, is_conflict=True,
is_unprocessable_entity=False, is_unprocessable_entity=False,
plugin='nova', plugin='nova',
exception=lambda: fakes_v1_1.fake_exception(409), exception=lambda: fakes_nova.fake_exception(409),
)), )),
('swift_not_found', dict( ('swift_not_found', dict(
is_not_found=True, is_not_found=True,

View File

@ -26,8 +26,8 @@ from heat.engine.resources.aws.ec2 import eip
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
eip_template = ''' eip_template = '''
@ -160,7 +160,7 @@ class EIPTest(common.HeatTestCase):
def setUp(self): def setUp(self):
# force Nova, will test Neutron below # force Nova, will test Neutron below
super(EIPTest, self).setUp() super(EIPTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create') self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
self.m.StubOutWithMock(self.fc.servers, 'get') self.m.StubOutWithMock(self.fc.servers, 'get')
@ -286,7 +286,7 @@ class EIPTest(common.HeatTestCase):
def test_eip_with_exception(self): def test_eip_with_exception(self):
self.m.StubOutWithMock(self.fc.floating_ips, 'create') self.m.StubOutWithMock(self.fc.floating_ips, 'create')
nova.NovaClientPlugin._create().AndReturn(self.fc) nova.NovaClientPlugin._create().AndReturn(self.fc)
self.fc.floating_ips.create().AndRaise(fakes_v1_1.fake_exception()) self.fc.floating_ips.create().AndRaise(fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()
t = template_format.parse(eip_template) t = template_format.parse(eip_template)
@ -305,7 +305,7 @@ class EIPTest(common.HeatTestCase):
self.m.StubOutWithMock(self.fc.floating_ips, 'delete') self.m.StubOutWithMock(self.fc.floating_ips, 'delete')
nova.NovaClientPlugin._create().AndReturn(self.fc) nova.NovaClientPlugin._create().AndReturn(self.fc)
self.fc.floating_ips.delete(mox.IsA(object)).AndRaise( self.fc.floating_ips.delete(mox.IsA(object)).AndRaise(
fakes_v1_1.fake_exception()) fakes_nova.fake_exception())
self.fc.servers.get(mox.IsA(object)).AndReturn(False) self.fc.servers.get(mox.IsA(object)).AndReturn(False)
self.m.ReplayAll() self.m.ReplayAll()
@ -371,7 +371,7 @@ class AllocTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(AllocTest, self).setUp() super(AllocTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.m.StubOutWithMock(self.fc.servers, 'get') self.m.StubOutWithMock(self.fc.servers, 'get')
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create') self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
self.m.StubOutWithMock(parser.Stack, 'resource_by_refid') self.m.StubOutWithMock(parser.Stack, 'resource_by_refid')
@ -700,7 +700,7 @@ class AllocTest(common.HeatTestCase):
self._mock_server_get(mock_server=server, multiple=True) self._mock_server_get(mock_server=server, multiple=True)
self.m.StubOutWithMock(self.fc.servers, 'add_floating_ip') self.m.StubOutWithMock(self.fc.servers, 'add_floating_ip')
self.fc.servers.add_floating_ip(server, '11.0.0.1').AndRaise( self.fc.servers.add_floating_ip(server, '11.0.0.1').AndRaise(
fakes_v1_1.fake_exception(400)) fakes_nova.fake_exception(400))
self.m.ReplayAll() self.m.ReplayAll()
t = template_format.parse(eip_template_ipassoc) t = template_format.parse(eip_template_ipassoc)

View File

@ -61,8 +61,8 @@ from heat.rpc import worker_api
from heat.tests import common from heat.tests import common
from heat.tests import fakes as test_fakes from heat.tests import fakes as test_fakes
from heat.tests import generic_resource as generic_rsrc from heat.tests import generic_resource as generic_rsrc
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
cfg.CONF.import_opt('engine_life_check_timeout', 'heat.common.config') cfg.CONF.import_opt('engine_life_check_timeout', 'heat.common.config')
cfg.CONF.import_opt('enable_stack_abandon', 'heat.common.config') cfg.CONF.import_opt('enable_stack_abandon', 'heat.common.config')
@ -216,7 +216,7 @@ def setup_mock_for_image_constraint(mocks, imageId_input,
def setup_mocks(mocks, stack, mock_image_constraint=True, def setup_mocks(mocks, stack, mock_image_constraint=True,
mock_keystone=True): mock_keystone=True):
fc = fakes_v1_1.FakeClient() fc = fakes_nova.FakeClient()
mocks.StubOutWithMock(instances.Instance, 'nova') mocks.StubOutWithMock(instances.Instance, 'nova')
instances.Instance.nova().MultipleTimes().AndReturn(fc) instances.Instance.nova().MultipleTimes().AndReturn(fc)
mocks.StubOutWithMock(nova.NovaClientPlugin, '_create') mocks.StubOutWithMock(nova.NovaClientPlugin, '_create')
@ -270,12 +270,12 @@ def setup_stack(stack_name, ctx, create_res=True):
def clean_up_stack(stack, delete_res=True): def clean_up_stack(stack, delete_res=True):
if delete_res: if delete_res:
m = mox.Mox() m = mox.Mox()
fc = fakes_v1_1.FakeClient() fc = fakes_nova.FakeClient()
m.StubOutWithMock(instances.Instance, 'nova') m.StubOutWithMock(instances.Instance, 'nova')
instances.Instance.nova().MultipleTimes().AndReturn(fc) instances.Instance.nova().MultipleTimes().AndReturn(fc)
m.StubOutWithMock(fc.client, 'get_servers_9999') m.StubOutWithMock(fc.client, 'get_servers_9999')
get = fc.client.get_servers_9999 get = fc.client.get_servers_9999
get().AndRaise(fakes_v1_1.fake_exception()) get().AndRaise(fakes_nova.fake_exception())
m.ReplayAll() m.ReplayAll()
stack.delete() stack.delete()
if delete_res: if delete_res:
@ -433,7 +433,7 @@ class StackCreateTest(common.HeatTestCase):
self.m.StubOutWithMock(fc.client, 'get_servers_9999') self.m.StubOutWithMock(fc.client, 'get_servers_9999')
get = fc.client.get_servers_9999 get = fc.client.get_servers_9999
get().AndRaise(fakes_v1_1.fake_exception()) get().AndRaise(fakes_nova.fake_exception())
mox.Replay(get) mox.Replay(get)
stack.delete() stack.delete()
@ -1671,7 +1671,7 @@ class StackServiceAuthorizeTest(common.HeatTestCase):
fc = setup_mocks(self.m, stack) fc = setup_mocks(self.m, stack)
self.m.StubOutWithMock(fc.client, 'get_servers_9999') self.m.StubOutWithMock(fc.client, 'get_servers_9999')
get = fc.client.get_servers_9999 get = fc.client.get_servers_9999
get().AndRaise(fakes_v1_1.fake_exception()) get().AndRaise(fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()
stack.store() stack.store()

View File

@ -32,8 +32,8 @@ from heat.engine import resource
from heat.engine.resources.aws.ec2 import instance as instances from heat.engine.resources.aws.ec2 import instance as instances
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
wp_template = ''' wp_template = '''
@ -75,7 +75,7 @@ wp_template = '''
class InstancesTest(common.HeatTestCase): class InstancesTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(InstancesTest, self).setUp() super(InstancesTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
def _setup_test_stack(self, stack_name): def _setup_test_stack(self, stack_name):
t = template_format.parse(wp_template) t = template_format.parse(wp_template)
@ -603,7 +603,7 @@ class InstancesTest(common.HeatTestCase):
d2['server']['status'] = vm_delete_status d2['server']['status'] = vm_delete_status
get().AndReturn((200, d2)) get().AndReturn((200, d2))
else: else:
get().AndRaise(fakes_v1_1.fake_exception()) get().AndRaise(fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()

View File

@ -21,8 +21,8 @@ from heat.engine import function
from heat.engine.resources.openstack.heat import instance_group as instgrp from heat.engine.resources.openstack.heat import instance_group as instgrp
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
ig_tmpl_without_updt_policy = ''' ig_tmpl_without_updt_policy = '''
@ -156,7 +156,7 @@ class InstanceGroupTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(InstanceGroupTest, self).setUp() super(InstanceGroupTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
def get_launch_conf_name(self, stack, ig_name): def get_launch_conf_name(self, stack, ig_name):
return stack[ig_name].properties['LaunchConfigurationName'] return stack[ig_name].properties['LaunchConfigurationName']

View File

@ -24,8 +24,8 @@ from heat.engine.resources.aws.ec2 import instance as instances
from heat.engine.resources.aws.ec2 import network_interface as net_interfaces from heat.engine.resources.aws.ec2 import network_interface as net_interfaces
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
wp_template = ''' wp_template = '''
@ -152,7 +152,7 @@ class FakeNeutron(object):
class instancesTest(common.HeatTestCase): class instancesTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(instancesTest, self).setUp() super(instancesTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
def _mock_get_image_id_success(self, imageId_input, imageId): def _mock_get_image_id_success(self, imageId_input, imageId):
self.m.StubOutWithMock(glance.GlanceClientPlugin, 'get_image_id') self.m.StubOutWithMock(glance.GlanceClientPlugin, 'get_image_id')
@ -187,7 +187,7 @@ class instancesTest(common.HeatTestCase):
d2['server']['status'] = vm_delete_status d2['server']['status'] = vm_delete_status
get().AndReturn((200, d2)) get().AndReturn((200, d2))
else: else:
get().AndRaise(fakes_v1_1.fake_exception()) get().AndRaise(fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()

View File

@ -22,8 +22,8 @@ from heat.engine.clients.os import nova
from heat.engine.resources.aws.lb import loadbalancer as lb from heat.engine.resources.aws.lb import loadbalancer as lb
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
lb_template = ''' lb_template = '''
@ -72,7 +72,7 @@ lb_template = '''
class LoadBalancerTest(common.HeatTestCase): class LoadBalancerTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(LoadBalancerTest, self).setUp() super(LoadBalancerTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
cfg.CONF.set_default('heat_waitcondition_server_url', cfg.CONF.set_default('heat_waitcondition_server_url',
'http://server.test:8000/v1/waitcondition') 'http://server.test:8000/v1/waitcondition')

View File

@ -17,8 +17,8 @@ from heat.engine.clients.os import nova
from heat.engine.resources.aws.ec2 import instance as instances from heat.engine.resources.aws.ec2 import instance as instances
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
nokey_template = ''' nokey_template = '''
@ -43,7 +43,7 @@ nokey_template = '''
class nokeyTest(common.HeatTestCase): class nokeyTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(nokeyTest, self).setUp() super(nokeyTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
def test_nokey_create(self): def test_nokey_create(self):

View File

@ -23,8 +23,8 @@ import six
from heat.common import exception from heat.common import exception
from heat.engine.clients.os import nova from heat.engine.clients.os import nova
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
class NovaClientPluginTestCase(common.HeatTestCase): class NovaClientPluginTestCase(common.HeatTestCase):
@ -327,7 +327,7 @@ class ServerConstraintTest(common.HeatTestCase):
class FlavorConstraintTest(common.HeatTestCase): class FlavorConstraintTest(common.HeatTestCase):
def test_validate(self): def test_validate(self):
client = fakes_v1_1.FakeClient() client = fakes_nova.FakeClient()
self.stub_keystoneclient() self.stub_keystoneclient()
self.patchobject(nova.NovaClientPlugin, '_create', return_value=client) self.patchobject(nova.NovaClientPlugin, '_create', return_value=client)
client.flavors = mock.MagicMock() client.flavors = mock.MagicMock()
@ -351,14 +351,14 @@ class FlavorConstraintTest(common.HeatTestCase):
class KeypairConstraintTest(common.HeatTestCase): class KeypairConstraintTest(common.HeatTestCase):
def test_validation(self): def test_validation(self):
client = fakes_v1_1.FakeClient() client = fakes_nova.FakeClient()
self.patchobject(nova.NovaClientPlugin, '_create', return_value=client) self.patchobject(nova.NovaClientPlugin, '_create', return_value=client)
client.keypairs = mock.MagicMock() client.keypairs = mock.MagicMock()
key = collections.namedtuple("Key", ["name"]) key = collections.namedtuple("Key", ["name"])
key.name = "foo" key.name = "foo"
client.keypairs.get.side_effect = [ client.keypairs.get.side_effect = [
fakes_v1_1.fake_exception(), key] fakes_nova.fake_exception(), key]
constraint = nova.KeypairConstraint() constraint = nova.KeypairConstraint()
ctx = utils.dummy_context() ctx = utils.dummy_context()

View File

@ -23,8 +23,8 @@ from heat.engine.resources.openstack.nova import nova_floatingip
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
floating_ip_template = ''' floating_ip_template = '''
@ -148,7 +148,7 @@ class NovaFloatingIPTest(common.HeatTestCase):
def test_delete_floating_ip_assoc_successful_if_create_failed(self): def test_delete_floating_ip_assoc_successful_if_create_failed(self):
rsrc = self.prepare_floating_ip_assoc() rsrc = self.prepare_floating_ip_assoc()
self.novaclient.servers.add_floating_ip(None, '11.0.0.1').AndRaise( self.novaclient.servers.add_floating_ip(None, '11.0.0.1').AndRaise(
fakes_v1_1.fake_exception(400)) fakes_nova.fake_exception(400))
self.m.ReplayAll() self.m.ReplayAll()
@ -215,7 +215,7 @@ class NovaFloatingIPTest(common.HeatTestCase):
) )
self.novaclient.servers.remove_floating_ip("server", self.novaclient.servers.remove_floating_ip("server",
"11.0.0.1").AndRaise( "11.0.0.1").AndRaise(
fakes_v1_1.fake_exception(exc_code)) fakes_nova.fake_exception(exc_code))
self.m.ReplayAll() self.m.ReplayAll()

View File

@ -21,8 +21,8 @@ from heat.engine.clients.os import nova
from heat.engine.resources.openstack.nova import nova_keypair from heat.engine.resources.openstack.nova import nova_keypair
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
class NovaKeyPairTest(common.HeatTestCase): class NovaKeyPairTest(common.HeatTestCase):
@ -158,7 +158,7 @@ class NovaKeyPairTest(common.HeatTestCase):
test_res.resource_id = "key_name" test_res.resource_id = "key_name"
test_res.state_set(test_res.CREATE, test_res.COMPLETE) test_res.state_set(test_res.CREATE, test_res.COMPLETE)
(self.fake_keypairs.delete("key_name") (self.fake_keypairs.delete("key_name")
.AndRaise(fakes_v1_1.fake_exception())) .AndRaise(fakes_nova.fake_exception()))
self.m.ReplayAll() self.m.ReplayAll()
scheduler.TaskRunner(test_res.delete)() scheduler.TaskRunner(test_res.delete)()
self.assertEqual((test_res.DELETE, test_res.COMPLETE), test_res.state) self.assertEqual((test_res.DELETE, test_res.COMPLETE), test_res.state)

View File

@ -18,8 +18,8 @@ import mock
from heat.common import template_format from heat.common import template_format
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
sg_template = { sg_template = {
"heat_template_version": "2013-05-23", "heat_template_version": "2013-05-23",
@ -100,7 +100,7 @@ class NovaServerGroupTest(common.HeatTestCase):
def test_sg_delete_not_found(self): def test_sg_delete_not_found(self):
self._create_sg('test') self._create_sg('test')
self.sg_mgr.delete.side_effect = fakes_v1_1.fake_exception() self.sg_mgr.delete.side_effect = fakes_nova.fake_exception()
scheduler.TaskRunner(self.sg.delete)() scheduler.TaskRunner(self.sg.delete)()
self.sg_mgr.delete.assert_called_once_with('test') self.sg_mgr.delete.assert_called_once_with('test')
self.assertEqual((self.sg.DELETE, self.sg.COMPLETE), self.assertEqual((self.sg.DELETE, self.sg.COMPLETE),

View File

@ -23,7 +23,7 @@ from heat.common import exception
from heat.engine import nova_utils from heat.engine import nova_utils
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.v1_1 import fakes as fakes_v1_1 from heat.tests.nova import fakes as fakes_nova
class NovaUtilsTests(common.HeatTestCase): class NovaUtilsTests(common.HeatTestCase):
@ -91,7 +91,7 @@ class NovaUtilsTests(common.HeatTestCase):
self.nova_client.keypairs.get( self.nova_client.keypairs.get(
my_key_name).AndReturn(my_key) my_key_name).AndReturn(my_key)
self.nova_client.keypairs.get( self.nova_client.keypairs.get(
'notakey').AndRaise(fakes_v1_1.fake_exception()) 'notakey').AndRaise(fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()
self.assertEqual(my_key, nova_utils.get_keypair(self.nova_client, self.assertEqual(my_key, nova_utils.get_keypair(self.nova_client,
my_key_name)) my_key_name))
@ -147,12 +147,12 @@ class NovaUtilsRefreshServerTests(common.HeatTestCase):
def test_overlimit_error(self): def test_overlimit_error(self):
server = mock.Mock() server = mock.Mock()
server.get.side_effect = fakes_v1_1.fake_exception(413) server.get.side_effect = fakes_nova.fake_exception(413)
self.assertIsNone(nova_utils.refresh_server(server)) self.assertIsNone(nova_utils.refresh_server(server))
def test_500_error(self): def test_500_error(self):
server = self.m.CreateMockAnything() server = self.m.CreateMockAnything()
server.get().AndRaise(fakes_v1_1.fake_exception(500)) server.get().AndRaise(fakes_nova.fake_exception(500))
self.m.ReplayAll() self.m.ReplayAll()
self.assertIsNone(nova_utils.refresh_server(server)) self.assertIsNone(nova_utils.refresh_server(server))
@ -160,7 +160,7 @@ class NovaUtilsRefreshServerTests(common.HeatTestCase):
def test_503_error(self): def test_503_error(self):
server = self.m.CreateMockAnything() server = self.m.CreateMockAnything()
server.get().AndRaise(fakes_v1_1.fake_exception(503)) server.get().AndRaise(fakes_nova.fake_exception(503))
self.m.ReplayAll() self.m.ReplayAll()
self.assertIsNone(nova_utils.refresh_server(server)) self.assertIsNone(nova_utils.refresh_server(server))
@ -168,7 +168,7 @@ class NovaUtilsRefreshServerTests(common.HeatTestCase):
def test_unhandled_exception(self): def test_unhandled_exception(self):
server = self.m.CreateMockAnything() server = self.m.CreateMockAnything()
server.get().AndRaise(fakes_v1_1.fake_exception(501)) server.get().AndRaise(fakes_nova.fake_exception(501))
self.m.ReplayAll() self.m.ReplayAll()
self.assertRaises(nova_exceptions.ClientException, self.assertRaises(nova_exceptions.ClientException,

View File

@ -17,8 +17,8 @@ import copy
from keystoneclient import exceptions as keystone_exc from keystoneclient import exceptions as keystone_exc
from neutronclient.common import exceptions as neutron_exc from neutronclient.common import exceptions as neutron_exc
from neutronclient.v2_0 import client as neutronclient from neutronclient.v2_0 import client as neutronclient
from novaclient.v1_1 import security_group_rules as nova_sgr from novaclient.v2 import security_group_rules as nova_sgr
from novaclient.v1_1 import security_groups as nova_sg from novaclient.v2 import security_groups as nova_sg
from heat.common import exception from heat.common import exception
from heat.common import template_format from heat.common import template_format
@ -28,8 +28,8 @@ from heat.engine import rsrc_defn
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import template from heat.engine import template
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
NovaSG = collections.namedtuple('NovaSG', NovaSG = collections.namedtuple('NovaSG',
@ -130,7 +130,7 @@ Resources:
def setUp(self): def setUp(self):
super(SecurityGroupTest, self).setUp() super(SecurityGroupTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create') self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'create') self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'create')
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'delete') self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'delete')
@ -602,16 +602,16 @@ Resources:
nova_sgr.SecurityGroupRuleManager.create( nova_sgr.SecurityGroupRuleManager.create(
2, 'tcp', 22, 22, '0.0.0.0/0', None).AndRaise( 2, 'tcp', 22, 22, '0.0.0.0/0', None).AndRaise(
fakes_v1_1.fake_exception(400, 'Rule already exists')) fakes_nova.fake_exception(400, 'Rule already exists'))
nova_sgr.SecurityGroupRuleManager.create( nova_sgr.SecurityGroupRuleManager.create(
2, 'tcp', 80, 80, '0.0.0.0/0', None).AndReturn( 2, 'tcp', 80, 80, '0.0.0.0/0', None).AndReturn(
fakes_v1_1.fake_exception(400, 'Rule already exists')) fakes_nova.fake_exception(400, 'Rule already exists'))
nova_sgr.SecurityGroupRuleManager.create( nova_sgr.SecurityGroupRuleManager.create(
2, 'tcp', None, None, None, 1).AndReturn( 2, 'tcp', None, None, None, 1).AndReturn(
fakes_v1_1.fake_exception(400, 'Rule already exists')) fakes_nova.fake_exception(400, 'Rule already exists'))
nova_sgr.SecurityGroupRuleManager.create( nova_sgr.SecurityGroupRuleManager.create(
2, 'icmp', None, None, None, '1').AndReturn( 2, 'icmp', None, None, None, '1').AndReturn(
fakes_v1_1.fake_exception(400, 'Rule already exists')) fakes_nova.fake_exception(400, 'Rule already exists'))
# delete script # delete script
nova_sg.SecurityGroupManager.get(2).AndReturn(NovaSG( nova_sg.SecurityGroupManager.get(2).AndReturn(NovaSG(
@ -663,17 +663,17 @@ Resources:
}] }]
)) ))
nova_sgr.SecurityGroupRuleManager.delete(130).AndRaise( nova_sgr.SecurityGroupRuleManager.delete(130).AndRaise(
fakes_v1_1.fake_exception()) fakes_nova.fake_exception())
nova_sgr.SecurityGroupRuleManager.delete(131).AndRaise( nova_sgr.SecurityGroupRuleManager.delete(131).AndRaise(
fakes_v1_1.fake_exception()) fakes_nova.fake_exception())
nova_sgr.SecurityGroupRuleManager.delete(132).AndRaise( nova_sgr.SecurityGroupRuleManager.delete(132).AndRaise(
fakes_v1_1.fake_exception()) fakes_nova.fake_exception())
nova_sgr.SecurityGroupRuleManager.delete(133).AndRaise( nova_sgr.SecurityGroupRuleManager.delete(133).AndRaise(
fakes_v1_1.fake_exception()) fakes_nova.fake_exception())
nova_sg.SecurityGroupManager.delete(2).AndReturn(None) nova_sg.SecurityGroupManager.delete(2).AndReturn(None)
nova_sg.SecurityGroupManager.get(2).AndRaise( nova_sg.SecurityGroupManager.get(2).AndRaise(
fakes_v1_1.fake_exception()) fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()
stack = self.create_stack(self.test_template_nova) stack = self.create_stack(self.test_template_nova)

View File

@ -35,8 +35,8 @@ from heat.engine import scheduler
from heat.engine import template from heat.engine import template
from heat.objects import resource_data as resource_data_object from heat.objects import resource_data as resource_data_object
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
wp_template = ''' wp_template = '''
@ -98,7 +98,7 @@ resources:
class ServersTest(common.HeatTestCase): class ServersTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(ServersTest, self).setUp() super(ServersTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.limits = self.m.CreateMockAnything() self.limits = self.m.CreateMockAnything()
self.limits.absolute = self._limits_absolute() self.limits.absolute = self._limits_absolute()
@ -1126,7 +1126,7 @@ class ServersTest(common.HeatTestCase):
self.m.StubOutWithMock(self.fc.client, 'get_servers_1234') self.m.StubOutWithMock(self.fc.client, 'get_servers_1234')
get = self.fc.client.get_servers_1234 get = self.fc.client.get_servers_1234
get().AndReturn(server_get) get().AndReturn(server_get)
get().AndRaise(fakes_v1_1.fake_exception()) get().AndRaise(fakes_nova.fake_exception())
mox.Replay(get) mox.Replay(get)
self.m.ReplayAll() self.m.ReplayAll()
@ -1145,7 +1145,7 @@ class ServersTest(common.HeatTestCase):
self.m.StubOutWithMock(self.fc.client, 'get_servers_1234') self.m.StubOutWithMock(self.fc.client, 'get_servers_1234')
get = self.fc.client.get_servers_1234 get = self.fc.client.get_servers_1234
get().AndRaise(fakes_v1_1.fake_exception()) get().AndRaise(fakes_nova.fake_exception())
mox.Replay(get) mox.Replay(get)
scheduler.TaskRunner(server.delete)() scheduler.TaskRunner(server.delete)()
@ -1634,7 +1634,7 @@ class ServersTest(common.HeatTestCase):
server.resource_id = '1234' server.resource_id = '1234'
self.m.StubOutWithMock(self.fc.client, 'get_servers_1234') self.m.StubOutWithMock(self.fc.client, 'get_servers_1234')
get = self.fc.client.get_servers_1234 get = self.fc.client.get_servers_1234
get().AndRaise(fakes_v1_1.fake_exception()) get().AndRaise(fakes_nova.fake_exception())
mox.Replay(get) mox.Replay(get)
self.m.ReplayAll() self.m.ReplayAll()
@ -1803,7 +1803,7 @@ class ServersTest(common.HeatTestCase):
# return the SUSPENDED state first (twice, so we sleep) # return the SUSPENDED state first (twice, so we sleep)
self.m.StubOutWithMock(self.fc.client, 'get_servers_1234') self.m.StubOutWithMock(self.fc.client, 'get_servers_1234')
get = self.fc.client.get_servers_1234 get = self.fc.client.get_servers_1234
get().AndRaise(fakes_v1_1.fake_exception()) get().AndRaise(fakes_nova.fake_exception())
self.m.ReplayAll() self.m.ReplayAll()
server.state_set(server.SUSPEND, server.COMPLETE) server.state_set(server.SUSPEND, server.COMPLETE)
@ -2340,7 +2340,7 @@ class ServersTest(common.HeatTestCase):
server.resource_id = '1234' server.resource_id = '1234'
self.m.StubOutWithMock(self.fc.client, 'get_servers_1234') self.m.StubOutWithMock(self.fc.client, 'get_servers_1234')
get = self.fc.client.get_servers_1234 get = self.fc.client.get_servers_1234
get().AndRaise(fakes_v1_1.fake_exception()) get().AndRaise(fakes_nova.fake_exception())
mox.Replay(get) mox.Replay(get)
self.m.ReplayAll() self.m.ReplayAll()

View File

@ -22,8 +22,8 @@ from heat.engine import parser
from heat.engine.resources.aws.ec2 import instance as instances from heat.engine.resources.aws.ec2 import instance as instances
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
instance_template = ''' instance_template = '''
@ -55,7 +55,7 @@ instance_template = '''
class ServerTagsTest(common.HeatTestCase): class ServerTagsTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(ServerTagsTest, self).setUp() super(ServerTagsTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
def _mock_get_image_id_success(self, imageId_input, imageId): def _mock_get_image_id_success(self, imageId_input, imageId):
self.m.StubOutWithMock(glance.GlanceClientPlugin, 'get_image_id') self.m.StubOutWithMock(glance.GlanceClientPlugin, 'get_image_id')

View File

@ -35,8 +35,8 @@ from heat.engine import stack
from heat.engine import template from heat.engine import template
from heat.tests import common from heat.tests import common
from heat.tests import generic_resource as generic_rsrc from heat.tests import generic_resource as generic_rsrc
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
mapping_template = template_format.parse('''{ mapping_template = template_format.parse('''{
@ -684,7 +684,7 @@ Mappings:
stk = stack.Stack(self.ctx, 'test_stack', stk = stack.Stack(self.ctx, 'test_stack',
template.Template(empty_template)) template.Template(empty_template))
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create') self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
fc = fakes_v1_1.FakeClient() fc = fakes_nova.FakeClient()
nova.NovaClientPlugin._create().AndReturn(fc) nova.NovaClientPlugin._create().AndReturn(fc)
self.m.ReplayAll() self.m.ReplayAll()
self.assertEqual(["nova1"], self.resolve(snippet, tmpl, stk)) self.assertEqual(["nova1"], self.resolve(snippet, tmpl, stk))

View File

@ -25,8 +25,8 @@ from heat.engine import parser
from heat.engine import resources from heat.engine import resources
from heat.engine import service from heat.engine import service
from heat.tests import common from heat.tests import common
from heat.tests.nova import fakes as fakes_nova
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes_v1_1
test_template_volumeattach = ''' test_template_volumeattach = '''
{ {
@ -815,8 +815,8 @@ class validateTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(validateTest, self).setUp() super(validateTest, self).setUp()
resources.initialise() resources.initialise()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.gc = fakes_v1_1.FakeClient() self.gc = fakes_nova.FakeClient()
resources.initialise() resources.initialise()
self.ctx = utils.dummy_context() self.ctx = utils.dummy_context()
self.patch('heat.engine.service.warnings') self.patch('heat.engine.service.warnings')

View File

@ -21,13 +21,13 @@ from heat.engine.resources.aws.ec2 import volume as aws_vol
from heat.engine.resources.openstack.cinder import volume as os_vol from heat.engine.resources.openstack.cinder import volume as os_vol
from heat.engine import scheduler from heat.engine import scheduler
from heat.tests import common from heat.tests import common
from heat.tests.v1_1 import fakes as fakes_v1_1 from heat.tests.nova import fakes as fakes_nova
class BaseVolumeTest(common.HeatTestCase): class BaseVolumeTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(BaseVolumeTest, self).setUp() super(BaseVolumeTest, self).setUp()
self.fc = fakes_v1_1.FakeClient() self.fc = fakes_nova.FakeClient()
self.cinder_fc = cinderclient.Client('username', 'password') self.cinder_fc = cinderclient.Client('username', 'password')
self.cinder_fc.volume_api_version = 2 self.cinder_fc.volume_api_version = 2
self.m.StubOutWithMock(cinder.CinderClientPlugin, '_create') self.m.StubOutWithMock(cinder.CinderClientPlugin, '_create')

View File

@ -1 +0,0 @@
BLAH