diff planemo/lib/python3.7/site-packages/bioblend/_tests/CloudmanTestBase.py @ 0:d30785e31577 draft

"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author guerler
date Fri, 31 Jul 2020 00:18:57 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/planemo/lib/python3.7/site-packages/bioblend/_tests/CloudmanTestBase.py	Fri Jul 31 00:18:57 2020 -0400
@@ -0,0 +1,68 @@
+"""
+Tests the functionality of the Blend CloudMan API. These tests require working
+credentials to supported cloud infrastructure.
+"""
+import os
+
+from bioblend.util import Bunch
+from . import test_util
+from .test_util import unittest
+
+
+class CloudmanTestBase(unittest.TestCase):
+
+    @classmethod
+    @test_util.skip_unless_cloudman()
+    def setUpClass(cls):
+        if os.environ.get('BIOBLEND_CLOUD_TYPE') == 'EC2':
+            cls.access_key = os.environ['BIOBLEND_ACCESS_KEY']
+            cls.secret_key = os.environ['BIOBLEND_SECRET_KEY']
+            cls.cluster_name = 'Blend CloudMan'
+            cls.ami_id = os.environ['BIOBLEND_AMI_ID']
+            cls.instance_type = 'm1.small'
+            cls.password = 'password'
+            cls.cloud_metadata = Bunch(
+                id='1',  # for compatibility w/ DB representation
+                name="Amazon",
+                cloud_type="ec2",
+                bucket_default="cloudman",
+                region_name="us-east-1",
+                region_endpoint="ec2.amazonaws.com",
+                ec2_port="",
+                ec2_conn_path="/",
+                cidr_range="",
+                is_secure=True,
+                s3_host="s3.amazonaws.com",
+                s3_port="",
+                s3_conn_path='/')
+        else:
+            # Assume OpenStack/NeCTAR
+            cls.access_key = os.environ['BIOBLEND_ACCESS_KEY']
+            cls.secret_key = os.environ['BIOBLEND_SECRET_KEY']
+            cls.cloud_metadata = Bunch(
+                id='-1',
+                name="NeCTAR",
+                cloud_type='openstack',
+                bucket_default='cloudman-os',
+                region_name='melbourne',
+                region_endpoint='nova.rc.nectar.org.au',
+                ec2_port=8773,
+                ec2_conn_path='/services/Cloud',
+                cidr_range='115.146.92.0/22',
+                is_secure=True,
+                s3_host='swift.rc.nectar.org.au',
+                s3_port=8888,
+                s3_conn_path='/')
+            cls.cluster_name = 'Blend CloudMan'
+            cls.ami_id = os.environ['BIOBLEND_AMI_ID']
+            cls.instance_type = 'm1.small'
+            cls.password = 'password'
+
+    @classmethod
+    @test_util.skip_unless_cloudman()
+    def tearDownClass(cls):
+        try:
+            # TODO: cloudman's terminate method has a bug. Needs fix
+            cls.cmi.terminate(delete_cluster=True)
+        except Exception:
+            pass