comparison env/lib/python3.7/site-packages/bioblend/_tests/CloudmanTestBase.py @ 0:26e78fe6e8c4 draft

"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author shellac
date Sat, 02 May 2020 07:14:21 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:26e78fe6e8c4
1 """
2 Tests the functionality of the Blend CloudMan API. These tests require working
3 credentials to supported cloud infrastructure.
4 """
5 import os
6
7 from bioblend.util import Bunch
8 from . import test_util
9 from .test_util import unittest
10
11
12 class CloudmanTestBase(unittest.TestCase):
13
14 @classmethod
15 @test_util.skip_unless_cloudman()
16 def setUpClass(cls):
17 if os.environ.get('BIOBLEND_CLOUD_TYPE') == 'EC2':
18 cls.access_key = os.environ['BIOBLEND_ACCESS_KEY']
19 cls.secret_key = os.environ['BIOBLEND_SECRET_KEY']
20 cls.cluster_name = 'Blend CloudMan'
21 cls.ami_id = os.environ['BIOBLEND_AMI_ID']
22 cls.instance_type = 'm1.small'
23 cls.password = 'password'
24 cls.cloud_metadata = Bunch(
25 id='1', # for compatibility w/ DB representation
26 name="Amazon",
27 cloud_type="ec2",
28 bucket_default="cloudman",
29 region_name="us-east-1",
30 region_endpoint="ec2.amazonaws.com",
31 ec2_port="",
32 ec2_conn_path="/",
33 cidr_range="",
34 is_secure=True,
35 s3_host="s3.amazonaws.com",
36 s3_port="",
37 s3_conn_path='/')
38 else:
39 # Assume OpenStack/NeCTAR
40 cls.access_key = os.environ['BIOBLEND_ACCESS_KEY']
41 cls.secret_key = os.environ['BIOBLEND_SECRET_KEY']
42 cls.cloud_metadata = Bunch(
43 id='-1',
44 name="NeCTAR",
45 cloud_type='openstack',
46 bucket_default='cloudman-os',
47 region_name='melbourne',
48 region_endpoint='nova.rc.nectar.org.au',
49 ec2_port=8773,
50 ec2_conn_path='/services/Cloud',
51 cidr_range='115.146.92.0/22',
52 is_secure=True,
53 s3_host='swift.rc.nectar.org.au',
54 s3_port=8888,
55 s3_conn_path='/')
56 cls.cluster_name = 'Blend CloudMan'
57 cls.ami_id = os.environ['BIOBLEND_AMI_ID']
58 cls.instance_type = 'm1.small'
59 cls.password = 'password'
60
61 @classmethod
62 @test_util.skip_unless_cloudman()
63 def tearDownClass(cls):
64 try:
65 # TODO: cloudman's terminate method has a bug. Needs fix
66 cls.cmi.terminate(delete_cluster=True)
67 except Exception:
68 pass