Give resource fakes a string ID
Resource ID values are actually UUIDs but unit tests assume they are typed as integers. This change uses the same numbers for test IDs but types them as strings, which makes the resource fakes closer to real-world usage. Change-Id: I8c9d6889db6451019e3986729906b5a37188c133
This commit is contained in:
parent
39934fef11
commit
613281fc2a
@ -301,7 +301,7 @@ class AutoScalingGroupTest(HeatTestCase):
|
||||
server.status = 'VERIFY_RESIZE'
|
||||
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
return_server.get = activate_status.__get__(return_server)
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
|
@ -1745,7 +1745,7 @@ class StackServiceTest(HeatTestCase):
|
||||
'metadata': {},
|
||||
'name': u'WebServer',
|
||||
'resource_data': {},
|
||||
'resource_id': 9999,
|
||||
'resource_id': '9999',
|
||||
'status': 'COMPLETE',
|
||||
'type': u'AWS::EC2::Instance'}}
|
||||
self.m.StubOutWithMock(stack_lock.StackLock, 'try_acquire')
|
||||
@ -1815,7 +1815,7 @@ class StackServiceTest(HeatTestCase):
|
||||
'metadata': {},
|
||||
'name': u'WebServer',
|
||||
'resource_data': {},
|
||||
'resource_id': 9999,
|
||||
'resource_id': '9999',
|
||||
'status': 'COMPLETE',
|
||||
'type': u'AWS::EC2::Instance'}}
|
||||
self.m.ReplayAll()
|
||||
|
@ -291,7 +291,7 @@ class InstancesTest(HeatTestCase):
|
||||
return_server = self.fc.servers.list()[1]
|
||||
instance = self._create_test_instance(return_server,
|
||||
'in_cr_del')
|
||||
instance.resource_id = 1234
|
||||
instance.resource_id = '1234'
|
||||
instance.status = vm_status
|
||||
|
||||
# this makes sure the auto increment worked on instance creation
|
||||
@ -348,7 +348,7 @@ class InstancesTest(HeatTestCase):
|
||||
the change making a resize API call against Nova.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
instance = self._create_test_instance(return_server,
|
||||
'ud_type')
|
||||
|
||||
@ -356,7 +356,7 @@ class InstancesTest(HeatTestCase):
|
||||
update_template['Properties']['InstanceType'] = 'm1.small'
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
|
||||
def activate_status(server):
|
||||
server.status = 'VERIFY_RESIZE'
|
||||
@ -379,7 +379,7 @@ class InstancesTest(HeatTestCase):
|
||||
call failed, so we raise an explicit error.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
instance = self._create_test_instance(return_server,
|
||||
'ud_type_f')
|
||||
|
||||
@ -387,7 +387,7 @@ class InstancesTest(HeatTestCase):
|
||||
update_template['Properties']['InstanceType'] = 'm1.small'
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
|
||||
def activate_status(server):
|
||||
server.status = 'ACTIVE'
|
||||
@ -421,7 +421,7 @@ class InstancesTest(HeatTestCase):
|
||||
and makes the change making a resize API call against Nova.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
instance = self._create_test_instance(return_server,
|
||||
'ud_network_interfaces')
|
||||
# if new overlaps with old, detach the different ones in old, and
|
||||
@ -442,7 +442,7 @@ class InstancesTest(HeatTestCase):
|
||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
self.m.StubOutWithMock(return_server, 'interface_detach')
|
||||
return_server.interface_detach(
|
||||
'd1e9c73c-04fe-4e9e-983c-d5ef94cd1a46').AndReturn(None)
|
||||
@ -461,7 +461,7 @@ class InstancesTest(HeatTestCase):
|
||||
and makes the change making a resize API call against Nova.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
instance = self._create_test_instance(return_server,
|
||||
'ud_network_interfaces')
|
||||
# if old include new, just detach the different ones in old
|
||||
@ -479,7 +479,7 @@ class InstancesTest(HeatTestCase):
|
||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
self.m.StubOutWithMock(return_server, 'interface_detach')
|
||||
return_server.interface_detach(
|
||||
'd1e9c73c-04fe-4e9e-983c-d5ef94cd1a46').AndReturn(None)
|
||||
@ -495,7 +495,7 @@ class InstancesTest(HeatTestCase):
|
||||
and makes the change making a resize API call against Nova.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
instance = self._create_test_instance(return_server,
|
||||
'ud_network_interfaces')
|
||||
# if new include old, just attach the different ones in new
|
||||
@ -513,7 +513,7 @@ class InstancesTest(HeatTestCase):
|
||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
self.m.StubOutWithMock(return_server, 'interface_attach')
|
||||
return_server.interface_attach('d1e9c73c-04fe-4e9e-983c-d5ef94cd1a46',
|
||||
None, None).AndReturn(None)
|
||||
@ -529,7 +529,7 @@ class InstancesTest(HeatTestCase):
|
||||
and makes the change making a resize API call against Nova.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
instance = self._create_test_instance(return_server,
|
||||
'ud_network_interfaces')
|
||||
# if different, detach the old ones and attach the new ones
|
||||
@ -547,7 +547,7 @@ class InstancesTest(HeatTestCase):
|
||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
self.m.StubOutWithMock(return_server, 'interface_detach')
|
||||
return_server.interface_detach(
|
||||
'ea29f957-cd35-4364-98fb-57ce9732c10d').AndReturn(None)
|
||||
@ -568,7 +568,7 @@ class InstancesTest(HeatTestCase):
|
||||
and makes the change making a resize API call against Nova.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
instance = self._create_test_instance(return_server,
|
||||
'ud_network_interfaces')
|
||||
new_interfaces = [
|
||||
@ -584,7 +584,7 @@ class InstancesTest(HeatTestCase):
|
||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
self.m.StubOutWithMock(return_server, 'interface_list')
|
||||
return_server.interface_list().AndReturn([iface])
|
||||
self.m.StubOutWithMock(return_server, 'interface_detach')
|
||||
@ -608,7 +608,7 @@ class InstancesTest(HeatTestCase):
|
||||
and makes the change making a resize API call against Nova.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
instance = self._create_test_instance(return_server,
|
||||
'ud_network_interfaces')
|
||||
iface = self.create_fake_iface('d1e9c73c-04fe-4e9e-983c-d5ef94cd1a46',
|
||||
@ -619,7 +619,7 @@ class InstancesTest(HeatTestCase):
|
||||
update_template['Properties']['NetworkInterfaces'] = []
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
self.m.StubOutWithMock(return_server, 'interface_list')
|
||||
return_server.interface_list().AndReturn([iface])
|
||||
self.m.StubOutWithMock(return_server, 'interface_detach')
|
||||
@ -639,7 +639,7 @@ class InstancesTest(HeatTestCase):
|
||||
and makes the change making a resize API call against Nova.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
instance = self._create_test_instance(return_server,
|
||||
'ud_network_interfaces')
|
||||
iface = self.create_fake_iface('d1e9c73c-04fe-4e9e-983c-d5ef94cd1a46',
|
||||
@ -652,7 +652,7 @@ class InstancesTest(HeatTestCase):
|
||||
update_template['Properties']['SubnetId'] = subnet_id
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
self.m.StubOutWithMock(return_server, 'interface_list')
|
||||
return_server.interface_list().AndReturn([iface])
|
||||
self.m.StubOutWithMock(return_server, 'interface_detach')
|
||||
@ -699,7 +699,7 @@ class InstancesTest(HeatTestCase):
|
||||
return_server = self.fc.servers.list()[0]
|
||||
instance = self._setup_test_instance(return_server,
|
||||
'in_sts_build')
|
||||
instance.resource_id = 1234
|
||||
instance.resource_id = '1234'
|
||||
|
||||
# Bind fake get method which Instance.check_create_complete will call
|
||||
def activate_status(server):
|
||||
@ -715,7 +715,7 @@ class InstancesTest(HeatTestCase):
|
||||
instance = self._create_test_instance(return_server,
|
||||
'in_suspend')
|
||||
|
||||
instance.resource_id = 1234
|
||||
instance.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to SUSPENDED
|
||||
@ -736,7 +736,7 @@ class InstancesTest(HeatTestCase):
|
||||
instance = self._create_test_instance(return_server,
|
||||
'in_resume')
|
||||
|
||||
instance.resource_id = 1234
|
||||
instance.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to SUSPENDED
|
||||
@ -758,7 +758,7 @@ class InstancesTest(HeatTestCase):
|
||||
instance = self._create_test_instance(return_server,
|
||||
'in_suspend_wait')
|
||||
|
||||
instance.resource_id = 1234
|
||||
instance.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to SUSPENDED, but
|
||||
@ -784,7 +784,7 @@ class InstancesTest(HeatTestCase):
|
||||
instance = self._create_test_instance(return_server,
|
||||
'in_resume_wait')
|
||||
|
||||
instance.resource_id = 1234
|
||||
instance.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to ACTIVE, but
|
||||
@ -812,7 +812,7 @@ class InstancesTest(HeatTestCase):
|
||||
instance = self._create_test_instance(return_server,
|
||||
'in_suspend_vol')
|
||||
|
||||
instance.resource_id = 1234
|
||||
instance.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to SUSPENDED
|
||||
@ -841,7 +841,7 @@ class InstancesTest(HeatTestCase):
|
||||
instance = self._create_test_instance(return_server,
|
||||
'in_resume_vol')
|
||||
|
||||
instance.resource_id = 1234
|
||||
instance.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to ACTIVE
|
||||
@ -873,7 +873,7 @@ class InstancesTest(HeatTestCase):
|
||||
instance = self._create_test_instance(return_server,
|
||||
'in_suspend_vol')
|
||||
|
||||
instance.resource_id = 1234
|
||||
instance.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to SUSPENDED, but keep
|
||||
@ -936,7 +936,7 @@ class InstancesTest(HeatTestCase):
|
||||
return_server = self.fc.servers.list()[0]
|
||||
instance = self._setup_test_instance(return_server,
|
||||
'in_sts_bld')
|
||||
instance.resource_id = 1234
|
||||
instance.resource_id = '1234'
|
||||
|
||||
# Bind fake get method which Instance.check_create_complete will call
|
||||
def activate_status(server):
|
||||
|
@ -218,7 +218,7 @@ class InstanceGroupTest(HeatTestCase):
|
||||
server.status = 'VERIFY_RESIZE'
|
||||
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
return_server.get = activate_status.__get__(return_server)
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
|
@ -153,7 +153,7 @@ class ServersTest(HeatTestCase):
|
||||
|
||||
def test_server_create(self):
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 5678
|
||||
return_server.id = '5678'
|
||||
server = self._create_test_server(return_server,
|
||||
'test_server_create')
|
||||
# this makes sure the auto increment worked on server creation
|
||||
@ -166,7 +166,7 @@ class ServersTest(HeatTestCase):
|
||||
'1013', 'fa:16:3e:8c:44:cc', '10.13.12.13')]
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(5678).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('5678').MultipleTimes().AndReturn(return_server)
|
||||
|
||||
self.m.StubOutWithMock(return_server, 'interface_list')
|
||||
return_server.interface_list().MultipleTimes().AndReturn(interfaces)
|
||||
@ -230,7 +230,7 @@ class ServersTest(HeatTestCase):
|
||||
|
||||
def test_server_create_with_image_id(self):
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 5678
|
||||
return_server.id = '5678'
|
||||
server = self._setup_test_server(return_server,
|
||||
'test_server_create_image_id',
|
||||
image_id='1',
|
||||
@ -245,7 +245,7 @@ class ServersTest(HeatTestCase):
|
||||
'1013', 'fa:16:3e:8c:44:cc', '10.13.12.13')]
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(5678).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('5678').MultipleTimes().AndReturn(return_server)
|
||||
|
||||
self.m.StubOutWithMock(return_server, 'interface_list')
|
||||
return_server.interface_list().MultipleTimes().AndReturn(interfaces)
|
||||
@ -517,7 +517,7 @@ class ServersTest(HeatTestCase):
|
||||
server.keystone().MultipleTimes().AndReturn(self.fkc)
|
||||
server.heat().MultipleTimes().AndReturn(self.fc)
|
||||
server._get_deployments_metadata(
|
||||
self.fc, 5678).AndReturn({'foo': 'bar'})
|
||||
self.fc, '5678').AndReturn({'foo': 'bar'})
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'create')
|
||||
self.fc.servers.create(
|
||||
@ -586,7 +586,7 @@ class ServersTest(HeatTestCase):
|
||||
server.keystone().MultipleTimes().AndReturn(self.fkc)
|
||||
server.heat().MultipleTimes().AndReturn(self.fc)
|
||||
server._get_deployments_metadata(
|
||||
self.fc, 5678).AndReturn({'foo': 'bar'})
|
||||
self.fc, '5678').AndReturn({'foo': 'bar'})
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'create')
|
||||
self.fc.servers.create(
|
||||
@ -906,7 +906,7 @@ class ServersTest(HeatTestCase):
|
||||
return_server = self.fc.servers.list()[1]
|
||||
server = self._create_test_server(return_server,
|
||||
'create_delete')
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
|
||||
# this makes sure the auto increment worked on server creation
|
||||
self.assertTrue(server.id > 0)
|
||||
@ -928,7 +928,7 @@ class ServersTest(HeatTestCase):
|
||||
return_server = self.fc.servers.list()[1]
|
||||
server = self._create_test_server(return_server,
|
||||
'create_delete2')
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
|
||||
# this makes sure the auto increment worked on server creation
|
||||
self.assertTrue(server.id > 0)
|
||||
@ -1054,7 +1054,7 @@ class ServersTest(HeatTestCase):
|
||||
Server.handle_update supports changing the name.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 5678
|
||||
return_server.id = '5678'
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_update')
|
||||
new_name = 'new_name'
|
||||
@ -1062,7 +1062,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['name'] = new_name
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(5678).AndReturn(return_server)
|
||||
self.fc.servers.get('5678').AndReturn(return_server)
|
||||
|
||||
self.m.StubOutWithMock(return_server, 'update')
|
||||
return_server.update(new_name).AndReturn(None)
|
||||
@ -1077,7 +1077,7 @@ class ServersTest(HeatTestCase):
|
||||
the change making a resize API call against Nova.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_update')
|
||||
|
||||
@ -1085,7 +1085,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['flavor'] = 'm1.small'
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
|
||||
def activate_status(server):
|
||||
server.status = 'VERIFY_RESIZE'
|
||||
@ -1108,7 +1108,7 @@ class ServersTest(HeatTestCase):
|
||||
call failed, so we raise an explicit error.
|
||||
"""
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_update2')
|
||||
|
||||
@ -1116,7 +1116,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['flavor'] = 'm1.small'
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).AndReturn(return_server)
|
||||
self.fc.servers.get('1234').AndReturn(return_server)
|
||||
|
||||
def activate_status(server):
|
||||
server.status = 'ACTIVE'
|
||||
@ -1196,7 +1196,7 @@ class ServersTest(HeatTestCase):
|
||||
# Server.handle_update supports changing the image, and makes
|
||||
# the change making a rebuild API call against Nova.
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_updimgrbld')
|
||||
|
||||
@ -1208,7 +1208,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['image'] = new_image
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
||||
self.m.StubOutWithMock(self.fc.servers, 'rebuild')
|
||||
# 744 is a static lookup from the fake images list
|
||||
if 'REBUILD' == policy:
|
||||
@ -1250,7 +1250,7 @@ class ServersTest(HeatTestCase):
|
||||
# If the status after a rebuild is not REBUILD or ACTIVE, it means the
|
||||
# rebuild call failed, so we raise an explicit error.
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 1234
|
||||
return_server.id = '1234'
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_updrbldfail')
|
||||
|
||||
@ -1262,7 +1262,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['image'] = new_image
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(1234).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
||||
self.m.StubOutWithMock(self.fc.servers, 'rebuild')
|
||||
# 744 is a static lookup from the fake images list
|
||||
self.fc.servers.rebuild(
|
||||
@ -1314,7 +1314,7 @@ class ServersTest(HeatTestCase):
|
||||
return_server = self.fc.servers.list()[0]
|
||||
server = self._setup_test_server(return_server,
|
||||
'sts_build')
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
|
||||
# Bind fake get method which Server.check_create_complete will call
|
||||
def activate_status(server):
|
||||
@ -1347,7 +1347,7 @@ class ServersTest(HeatTestCase):
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_sus2')
|
||||
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
self.m.StubOutWithMock(self.fc.client, 'get_servers_1234')
|
||||
get = self.fc.client.get_servers_1234
|
||||
get().AndRaise(servers.clients.novaclient.exceptions.NotFound(404))
|
||||
@ -1367,7 +1367,7 @@ class ServersTest(HeatTestCase):
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_suspend3')
|
||||
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to SUSPENDED
|
||||
@ -1388,7 +1388,7 @@ class ServersTest(HeatTestCase):
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_resume1')
|
||||
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to SUSPENDED
|
||||
@ -1410,7 +1410,7 @@ class ServersTest(HeatTestCase):
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_susp_w')
|
||||
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to SUSPENDED, but
|
||||
@ -1436,7 +1436,7 @@ class ServersTest(HeatTestCase):
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_susp_uk')
|
||||
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to SUSPENDED, but
|
||||
@ -1466,7 +1466,7 @@ class ServersTest(HeatTestCase):
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_res_w')
|
||||
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to ACTIVE, but
|
||||
@ -1512,7 +1512,7 @@ class ServersTest(HeatTestCase):
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_res_nf')
|
||||
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
self.m.ReplayAll()
|
||||
|
||||
# Override the get_servers_1234 handler status to ACTIVE, but
|
||||
@ -1566,7 +1566,7 @@ class ServersTest(HeatTestCase):
|
||||
return_server = self.fc.servers.list()[0]
|
||||
server = self._setup_test_server(return_server,
|
||||
'srv_sts_bld')
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
|
||||
check_iterations = [0]
|
||||
|
||||
@ -1616,12 +1616,12 @@ class ServersTest(HeatTestCase):
|
||||
|
||||
def test_server_without_ip_address(self):
|
||||
return_server = self.fc.servers.list()[3]
|
||||
return_server.id = 9102
|
||||
return_server.id = '9102'
|
||||
server = self._create_test_server(return_server,
|
||||
'wo_ipaddr')
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(9102).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('9102').MultipleTimes().AndReturn(return_server)
|
||||
|
||||
self.m.StubOutWithMock(return_server, 'interface_list')
|
||||
return_server.interface_list().MultipleTimes().AndReturn([])
|
||||
@ -1919,7 +1919,7 @@ class ServersTest(HeatTestCase):
|
||||
server = self._create_test_server(return_server,
|
||||
'srv_resolve_attr')
|
||||
|
||||
server.resource_id = 1234
|
||||
server.resource_id = '1234'
|
||||
self.m.StubOutWithMock(self.fc.client, 'get_servers_1234')
|
||||
get = self.fc.client.get_servers_1234
|
||||
get().AndRaise(servers.clients.novaclient.exceptions.NotFound(404))
|
||||
@ -2147,7 +2147,7 @@ class ServersTest(HeatTestCase):
|
||||
|
||||
def test_server_update_None_networks_with_port(self):
|
||||
return_server = self.fc.servers.list()[3]
|
||||
return_server.id = 9102
|
||||
return_server.id = '9102'
|
||||
server = self._create_test_server(return_server, 'networks_update')
|
||||
|
||||
new_networks = [{'port': '2a60cbaa-3d33-4af6-a9ce-83594ac546fc'}]
|
||||
@ -2155,7 +2155,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['networks'] = new_networks
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(9102).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('9102').MultipleTimes().AndReturn(return_server)
|
||||
# to make sure, that old_networks will be None
|
||||
self.assertFalse(hasattr(server.t['Properties'], 'networks'))
|
||||
|
||||
@ -2180,7 +2180,7 @@ class ServersTest(HeatTestCase):
|
||||
|
||||
def test_server_update_None_networks_with_network_id(self):
|
||||
return_server = self.fc.servers.list()[3]
|
||||
return_server.id = 9102
|
||||
return_server.id = '9102'
|
||||
server = self._create_test_server(return_server, 'networks_update')
|
||||
|
||||
new_networks = [{'network': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||
@ -2189,7 +2189,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['networks'] = new_networks
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(9102).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('9102').MultipleTimes().AndReturn(return_server)
|
||||
# to make sure, that old_networks will be None
|
||||
self.assertFalse(hasattr(server.t['Properties'], 'networks'))
|
||||
|
||||
@ -2215,7 +2215,7 @@ class ServersTest(HeatTestCase):
|
||||
|
||||
def test_server_update_empty_networks_with_complex_parameters(self):
|
||||
return_server = self.fc.servers.list()[3]
|
||||
return_server.id = 9102
|
||||
return_server.id = '9102'
|
||||
server = self._create_test_server(return_server, 'networks_update')
|
||||
|
||||
new_networks = [{'network': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||
@ -2225,7 +2225,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['networks'] = new_networks
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(9102).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('9102').MultipleTimes().AndReturn(return_server)
|
||||
# to make sure, that old_networks will be None
|
||||
self.assertFalse(hasattr(server.t['Properties'], 'networks'))
|
||||
|
||||
@ -2251,7 +2251,7 @@ class ServersTest(HeatTestCase):
|
||||
|
||||
def test_server_update_networks_with_complex_parameters(self):
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 5678
|
||||
return_server.id = '5678'
|
||||
server = self._create_test_server(return_server, 'networks_update')
|
||||
|
||||
old_networks = [
|
||||
@ -2272,7 +2272,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['networks'] = new_networks
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(5678).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('5678').MultipleTimes().AndReturn(return_server)
|
||||
|
||||
self.m.StubOutWithMock(return_server, 'interface_list')
|
||||
|
||||
@ -2312,7 +2312,7 @@ class ServersTest(HeatTestCase):
|
||||
|
||||
def test_server_update_networks_with_None(self):
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 5678
|
||||
return_server.id = '5678'
|
||||
server = self._create_test_server(return_server, 'networks_update')
|
||||
|
||||
old_networks = [
|
||||
@ -2326,7 +2326,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['networks'] = None
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(5678).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('5678').MultipleTimes().AndReturn(return_server)
|
||||
|
||||
self.m.StubOutWithMock(return_server, 'interface_list')
|
||||
|
||||
@ -2362,7 +2362,7 @@ class ServersTest(HeatTestCase):
|
||||
|
||||
def test_server_update_networks_with_empty_list(self):
|
||||
return_server = self.fc.servers.list()[1]
|
||||
return_server.id = 5678
|
||||
return_server.id = '5678'
|
||||
server = self._create_test_server(return_server, 'networks_update')
|
||||
|
||||
old_networks = [
|
||||
@ -2376,7 +2376,7 @@ class ServersTest(HeatTestCase):
|
||||
update_template['Properties']['networks'] = []
|
||||
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.fc.servers.get(5678).MultipleTimes().AndReturn(return_server)
|
||||
self.fc.servers.get('5678').MultipleTimes().AndReturn(return_server)
|
||||
|
||||
self.m.StubOutWithMock(return_server, 'interface_list')
|
||||
|
||||
|
@ -77,7 +77,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
def get_servers_detail(self, **kw):
|
||||
return (
|
||||
200,
|
||||
{"servers": [{"id": 1234,
|
||||
{"servers": [{"id": "1234",
|
||||
"name": "sample-server",
|
||||
"OS-EXT-SRV-ATTR:instance_name":
|
||||
"sample-server",
|
||||
@ -96,7 +96,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
"accessIPv6": "",
|
||||
"metadata": {"Server Label": "Web Head 1",
|
||||
"Image Version": "2.1"}},
|
||||
{"id": 5678,
|
||||
{"id": "5678",
|
||||
"name": "sample-server2",
|
||||
"OS-EXT-SRV-ATTR:instance_name":
|
||||
"sample-server2",
|
||||
@ -119,7 +119,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
"OS-EXT-IPS-MAC:mac_addr":
|
||||
"fa:16:3e:8c:44:cc"}]},
|
||||
"metadata": {}},
|
||||
{"id": 9101,
|
||||
{"id": "9101",
|
||||
"name": "hard-reboot",
|
||||
"OS-EXT-SRV-ATTR:instance_name":
|
||||
"hard-reboot",
|
||||
@ -136,7 +136,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
"private": [{"version": 4,
|
||||
"addr": "10.13.12.13"}]},
|
||||
"metadata": {"Server Label": "DB 1"}},
|
||||
{"id": 9102,
|
||||
{"id": "9102",
|
||||
"name": "server-with-no-ip",
|
||||
"OS-EXT-SRV-ATTR:instance_name":
|
||||
"server-with-no-ip",
|
||||
@ -148,7 +148,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
"accessIPv6": "",
|
||||
"addresses": {"empty_net": []},
|
||||
"metadata": {"Server Label": "DB 1"}},
|
||||
{"id": 9999,
|
||||
{"id": "9999",
|
||||
"name": "sample-server3",
|
||||
"OS-EXT-SRV-ATTR:instance_name":
|
||||
"sample-server3",
|
||||
|
Loading…
Reference in New Issue
Block a user