Move assign_keypair method in base class
Change-Id: I69b8db037991f88b38b293560532bf51c0a04378
This commit is contained in:
parent
784b28a2e8
commit
17993724ed
@ -200,6 +200,14 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
|
|||||||
self.addCleanup(delete_keypair)
|
self.addCleanup(delete_keypair)
|
||||||
return keypair
|
return keypair
|
||||||
|
|
||||||
|
def assign_keypair(self):
|
||||||
|
if self.conf.keypair_name:
|
||||||
|
self.keypair = None
|
||||||
|
self.keypair_name = self.conf.keypair_name
|
||||||
|
else:
|
||||||
|
self.keypair = self.create_keypair()
|
||||||
|
self.keypair_name = self.keypair.id
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _stack_rand_name(cls):
|
def _stack_rand_name(cls):
|
||||||
return rand_name(cls.__name__)
|
return rand_name(cls.__name__)
|
||||||
|
@ -361,11 +361,7 @@ Resources:
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TemplateResourceUpdateFailedTest, self).setUp()
|
super(TemplateResourceUpdateFailedTest, self).setUp()
|
||||||
self.client = self.orchestration_client
|
self.client = self.orchestration_client
|
||||||
if self.conf.keypair_name:
|
self.assign_keypair()
|
||||||
self.keypair_name = self.conf.keypair_name
|
|
||||||
else:
|
|
||||||
self.keypair = self.create_keypair()
|
|
||||||
self.keypair_name = self.keypair.id
|
|
||||||
|
|
||||||
def test_update_on_failed_create(self):
|
def test_update_on_failed_create(self):
|
||||||
# create a stack with "server" dependent on "keypair", but
|
# create a stack with "server" dependent on "keypair", but
|
||||||
|
@ -29,11 +29,7 @@ class StackValidationTest(test.HeatIntegrationTest):
|
|||||||
if not self.conf.instance_type:
|
if not self.conf.instance_type:
|
||||||
raise self.skipException("No instance_type configured to test")
|
raise self.skipException("No instance_type configured to test")
|
||||||
|
|
||||||
if self.conf.keypair_name:
|
self.assign_keypair()
|
||||||
self.keypair_name = self.conf.keypair_name
|
|
||||||
else:
|
|
||||||
self.keypair = self.create_keypair()
|
|
||||||
self.keypair_name = self.keypair.id
|
|
||||||
|
|
||||||
def test_stack_validate_provider_references_parent_resource(self):
|
def test_stack_validate_provider_references_parent_resource(self):
|
||||||
template = '''
|
template = '''
|
||||||
|
@ -25,18 +25,11 @@ class CfnInitIntegrationTest(test.HeatIntegrationTest):
|
|||||||
super(CfnInitIntegrationTest, self).setUp()
|
super(CfnInitIntegrationTest, self).setUp()
|
||||||
if not self.conf.image_ref:
|
if not self.conf.image_ref:
|
||||||
raise self.skipException("No image configured to test")
|
raise self.skipException("No image configured to test")
|
||||||
|
self.assign_keypair()
|
||||||
self.client = self.orchestration_client
|
self.client = self.orchestration_client
|
||||||
self.template_name = 'test_server_cfn_init.yaml'
|
self.template_name = 'test_server_cfn_init.yaml'
|
||||||
self.sub_dir = 'templates'
|
self.sub_dir = 'templates'
|
||||||
|
|
||||||
def assign_keypair(self):
|
|
||||||
if self.conf.keypair_name:
|
|
||||||
self.keypair = None
|
|
||||||
self.keypair_name = self.conf.keypair_name
|
|
||||||
else:
|
|
||||||
self.keypair = self.create_keypair()
|
|
||||||
self.keypair_name = self.keypair.id
|
|
||||||
|
|
||||||
def launch_stack(self):
|
def launch_stack(self):
|
||||||
net = self._get_default_network()
|
net = self._get_default_network()
|
||||||
parameters = {
|
parameters = {
|
||||||
@ -114,6 +107,5 @@ class CfnInitIntegrationTest(test.HeatIntegrationTest):
|
|||||||
raise e
|
raise e
|
||||||
|
|
||||||
def test_server_cfn_init(self):
|
def test_server_cfn_init(self):
|
||||||
self.assign_keypair()
|
|
||||||
sid = self.launch_stack()
|
sid = self.launch_stack()
|
||||||
self.check_stack(sid)
|
self.check_stack(sid)
|
||||||
|
@ -27,11 +27,7 @@ class VolumeBackupRestoreIntegrationTest(test.HeatIntegrationTest):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(VolumeBackupRestoreIntegrationTest, self).setUp()
|
super(VolumeBackupRestoreIntegrationTest, self).setUp()
|
||||||
self.client = self.orchestration_client
|
self.client = self.orchestration_client
|
||||||
if self.conf.keypair_name:
|
self.assign_keypair()
|
||||||
self.keypair_name = self.conf.keypair_name
|
|
||||||
else:
|
|
||||||
self.keypair = self.create_keypair()
|
|
||||||
self.keypair_name = self.keypair.id
|
|
||||||
self.volume_description = 'A test volume description 123'
|
self.volume_description = 'A test volume description 123'
|
||||||
self.volume_size = self.conf.volume_size
|
self.volume_size = self.conf.volume_size
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user