makes passing the client optional to utilities in scenario/manager.py
this makes passing the client optional to create_server and
create_security_group as it happens with the other utility methods
Change-Id: I56f7a4078d1da0c7b5bd7c493eb480d640be2805
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index f71ea46..44788f2 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -374,8 +374,10 @@
**ruleset)
self.set_resource(sg_rule.id, sg_rule)
- def create_server(self, client, name=None, image=None, flavor=None,
+ def create_server(self, client=None, name=None, image=None, flavor=None,
create_kwargs={}):
+ if client is None:
+ client = self.compute_client
if name is None:
name = rand_name('scenario-server-')
if image is None:
@@ -481,7 +483,9 @@
cls.config.identity.password,
cls.config.identity.tenant_name).tenant_id
- def _create_security_group(self, client, namestart='secgroup-smoke-'):
+ def _create_security_group(self, client=None, namestart='secgroup-smoke-'):
+ if client is None:
+ client = self.compute_client
# Create security group
sg_name = rand_name(namestart)
sg_desc = sg_name + " description"
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index ce4d1bd..752ff6f 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -87,8 +87,7 @@
def nova_boot(self):
create_kwargs = {'key_name': self.keypair.name}
- self.server = self.create_server(self.compute_client,
- image=self.image,
+ self.server = self.create_server(image=self.image,
create_kwargs=create_kwargs)
def nova_list(self):
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 2aa5de3..7f7ba91 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -168,8 +168,7 @@
name=rand_name('keypair-smoke-'))
def _create_security_groups(self):
- self.security_groups[self.tenant_id] = self._create_security_group(
- self.compute_client)
+ self.security_groups[self.tenant_id] = self._create_security_group()
def _create_networks(self):
network = self._create_network(self.tenant_id)
@@ -214,8 +213,7 @@
'key_name': keypair_name,
'security_groups': security_groups,
}
- server = self.create_server(self.compute_client, name=name,
- create_kwargs=create_kwargs)
+ server = self.create_server(name=name, create_kwargs=create_kwargs)
return server
def _create_servers(self):
diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py
index 26bc95e..853b1ba 100644
--- a/tempest/scenario/test_server_advanced_ops.py
+++ b/tempest/scenario/test_server_advanced_ops.py
@@ -48,7 +48,7 @@
@services('compute')
def test_resize_server_confirm(self):
# We create an instance for use in this test
- instance = self.create_server(self.compute_client)
+ instance = self.create_server()
instance_id = instance.id
resize_flavor = self.config.compute.flavor_ref_alt
LOG.debug("Resizing instance %s from flavor %s to flavor %s",
@@ -66,7 +66,7 @@
@services('compute')
def test_server_sequence_suspend_resume(self):
# We create an instance for use in this test
- instance = self.create_server(self.compute_client)
+ instance = self.create_server()
instance_id = instance.id
LOG.debug("Suspending instance %s. Current status: %s",
instance_id, instance.status)
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index 03e6e41..c32d49d 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -56,8 +56,7 @@
create_kwargs = {
'key_name': self.keypair.id
}
- instance = self.create_server(self.compute_client,
- create_kwargs=create_kwargs)
+ instance = self.create_server(create_kwargs=create_kwargs)
self.set_resource('instance', instance)
def pause_server(self):
diff --git a/tempest/scenario/test_snapshot_pattern.py b/tempest/scenario/test_snapshot_pattern.py
index 8c2cc76..ba347e0 100644
--- a/tempest/scenario/test_snapshot_pattern.py
+++ b/tempest/scenario/test_snapshot_pattern.py
@@ -34,8 +34,7 @@
create_kwargs = {
'key_name': self.keypair.name
}
- return self.create_server(self.compute_client, image=image_id,
- create_kwargs=create_kwargs)
+ return self.create_server(image=image_id, create_kwargs=create_kwargs)
def _add_keypair(self):
self.keypair = self.create_keypair()
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index ab464e3..4f49d65 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -58,8 +58,7 @@
create_kwargs = {
'key_name': self.keypair.name
}
- return self.create_server(self.compute_client, image=image_id,
- create_kwargs=create_kwargs)
+ return self.create_server(image=image_id, create_kwargs=create_kwargs)
def _add_keypair(self):
self.keypair = self.create_keypair()
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 3572166..d12cd56 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -49,8 +49,7 @@
'block_device_mapping': bd_map,
'key_name': keypair.name
}
- return self.create_server(self.compute_client,
- create_kwargs=create_kwargs)
+ return self.create_server(create_kwargs=create_kwargs)
def _create_snapshot_from_volume(self, vol_id):
volume_snapshots = self.volume_client.volume_snapshots