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