Split resource_setup for thirdparty tests
Split up the resource_setup method for the thirdparty/boto tests.
Partially-implements bp:resource-cleanup
Change-Id: I818ba34925e3a5450a86a5c5838c873348f31b8c
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index edd9de1..5b2ed70 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -201,10 +201,14 @@
raise cls.skipException("The EC2 API is not available")
@classmethod
+ def setup_credentials(cls):
+ super(BotoTestCase, cls).setup_credentials()
+ cls.os = cls.get_client_manager()
+
+ @classmethod
def resource_setup(cls):
super(BotoTestCase, cls).resource_setup()
cls.conclusion = decision_maker()
- cls.os = cls.get_client_manager()
# The trash contains cleanup functions and paramaters in tuples
# (function, *args, **kwargs)
cls._resource_trash_bin = {}
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index 707590e..a559b46 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -30,13 +30,17 @@
class InstanceRunTest(boto_test.BotoTestCase):
@classmethod
+ def setup_clients(cls):
+ super(InstanceRunTest, cls).setup_clients()
+ cls.s3_client = cls.os.s3_client
+ cls.ec2_client = cls.os.ec2api_client
+
+ @classmethod
def resource_setup(cls):
super(InstanceRunTest, cls).resource_setup()
if not cls.conclusion['A_I_IMAGES_READY']:
raise cls.skipException("".join(("EC2 ", cls.__name__,
": requires ami/aki/ari manifest")))
- cls.s3_client = cls.os.s3_client
- cls.ec2_client = cls.os.ec2api_client
cls.zone = CONF.boto.aws_zone
cls.materials_path = CONF.boto.s3_materials_path
ami_manifest = CONF.boto.ami_manifest
diff --git a/tempest/thirdparty/boto/test_ec2_keys.py b/tempest/thirdparty/boto/test_ec2_keys.py
index be5db55..a115635 100644
--- a/tempest/thirdparty/boto/test_ec2_keys.py
+++ b/tempest/thirdparty/boto/test_ec2_keys.py
@@ -25,9 +25,13 @@
class EC2KeysTest(boto_test.BotoTestCase):
@classmethod
+ def setup_clients(cls):
+ super(EC2KeysTest, cls).setup_clients()
+ cls.client = cls.os.ec2api_client
+
+ @classmethod
def resource_setup(cls):
super(EC2KeysTest, cls).resource_setup()
- cls.client = cls.os.ec2api_client
cls.ec = cls.ec2_error_code
# TODO(afazekas): merge create, delete, get test cases
diff --git a/tempest/thirdparty/boto/test_ec2_network.py b/tempest/thirdparty/boto/test_ec2_network.py
index 132a5a8..df0953e 100644
--- a/tempest/thirdparty/boto/test_ec2_network.py
+++ b/tempest/thirdparty/boto/test_ec2_network.py
@@ -19,8 +19,8 @@
class EC2NetworkTest(boto_test.BotoTestCase):
@classmethod
- def resource_setup(cls):
- super(EC2NetworkTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(EC2NetworkTest, cls).setup_clients()
cls.ec2_client = cls.os.ec2api_client
# Note(afazekas): these tests for things duable without an instance
diff --git a/tempest/thirdparty/boto/test_ec2_security_groups.py b/tempest/thirdparty/boto/test_ec2_security_groups.py
index fb3d32b..7143a70 100644
--- a/tempest/thirdparty/boto/test_ec2_security_groups.py
+++ b/tempest/thirdparty/boto/test_ec2_security_groups.py
@@ -20,8 +20,8 @@
class EC2SecurityGroupTest(boto_test.BotoTestCase):
@classmethod
- def resource_setup(cls):
- super(EC2SecurityGroupTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(EC2SecurityGroupTest, cls).setup_clients()
cls.client = cls.os.ec2api_client
def test_create_authorize_security_group(self):
diff --git a/tempest/thirdparty/boto/test_ec2_volumes.py b/tempest/thirdparty/boto/test_ec2_volumes.py
index 9cee8a4..034486b 100644
--- a/tempest/thirdparty/boto/test_ec2_volumes.py
+++ b/tempest/thirdparty/boto/test_ec2_volumes.py
@@ -29,14 +29,20 @@
class EC2VolumesTest(boto_test.BotoTestCase):
@classmethod
- def resource_setup(cls):
- super(EC2VolumesTest, cls).resource_setup()
-
+ def skip_checks(cls):
+ super(EC2VolumesTest, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+ @classmethod
+ def setup_clients(cls):
+ super(EC2VolumesTest, cls).setup_clients()
cls.client = cls.os.ec2api_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(EC2VolumesTest, cls).resource_setup()
cls.zone = CONF.boto.aws_zone
def test_create_get_delete(self):
diff --git a/tempest/thirdparty/boto/test_s3_buckets.py b/tempest/thirdparty/boto/test_s3_buckets.py
index 342fc0e..d880a7e 100644
--- a/tempest/thirdparty/boto/test_s3_buckets.py
+++ b/tempest/thirdparty/boto/test_s3_buckets.py
@@ -20,8 +20,8 @@
class S3BucketsTest(boto_test.BotoTestCase):
@classmethod
- def resource_setup(cls):
- super(S3BucketsTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(S3BucketsTest, cls).setup_clients()
cls.client = cls.os.s3_client
def test_create_and_get_delete_bucket(self):
diff --git a/tempest/thirdparty/boto/test_s3_ec2_images.py b/tempest/thirdparty/boto/test_s3_ec2_images.py
index f5dec95..e5eb044 100644
--- a/tempest/thirdparty/boto/test_s3_ec2_images.py
+++ b/tempest/thirdparty/boto/test_s3_ec2_images.py
@@ -26,13 +26,17 @@
class S3ImagesTest(boto_test.BotoTestCase):
@classmethod
+ def setup_clients(cls):
+ super(S3ImagesTest, cls).setup_clients()
+ cls.s3_client = cls.os.s3_client
+ cls.images_client = cls.os.ec2api_client
+
+ @classmethod
def resource_setup(cls):
super(S3ImagesTest, cls).resource_setup()
if not cls.conclusion['A_I_IMAGES_READY']:
raise cls.skipException("".join(("EC2 ", cls.__name__,
": requires ami/aki/ari manifest")))
- cls.s3_client = cls.os.s3_client
- cls.images_client = cls.os.ec2api_client
cls.materials_path = CONF.boto.s3_materials_path
cls.ami_manifest = CONF.boto.ami_manifest
cls.aki_manifest = CONF.boto.aki_manifest
diff --git a/tempest/thirdparty/boto/test_s3_objects.py b/tempest/thirdparty/boto/test_s3_objects.py
index 43774c2..f70a544 100644
--- a/tempest/thirdparty/boto/test_s3_objects.py
+++ b/tempest/thirdparty/boto/test_s3_objects.py
@@ -24,8 +24,8 @@
class S3BucketsTest(boto_test.BotoTestCase):
@classmethod
- def resource_setup(cls):
- super(S3BucketsTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(S3BucketsTest, cls).setup_clients()
cls.client = cls.os.s3_client
def test_create_get_delete_object(self):