comparison env/lib/python3.7/site-packages/bioblend/_tests/TestCloudmanLaunch.py @ 5:9b1c78e6ba9c draft default tip

"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author shellac
date Mon, 01 Jun 2020 08:59:25 -0400
parents 79f47841a781
children
comparison
equal deleted inserted replaced
4:79f47841a781 5:9b1c78e6ba9c
1 """
2 Tests the functionality of the Blend CloudMan API. These tests require working
3 credentials to supported cloud infrastructure.
4 """
5 from bioblend.cloudman import CloudManConfig, CloudManInstance
6 from . import CloudmanTestBase, test_util
7
8
9 @test_util.skip_unless_cloudman()
10 class TestCloudmanLaunch(CloudmanTestBase.CloudmanTestBase):
11
12 def setUp(self):
13 super(TestCloudmanLaunch, self).setUp()
14
15 def test_validate_valid_config(self):
16 """
17 Tests whether a valid config is validated properly.
18 """
19 # cfg = CloudManConfig(self.access_key, self.secret_key, self.cluster_name, self.ami_id, self.instance_type, self.password, cloud_metadata=self.cloud_metadata)
20 cls = TestCloudmanLaunch
21 cfg = CloudManConfig(cls.access_key, cls.secret_key, cls.cluster_name, cls.ami_id, cls.instance_type, cls.password, cloud_metadata=cls.cloud_metadata)
22 result = cfg.validate()
23 self.assertIsNone(result, "Validation did not return null to indicate success!")
24
25 def test_validate_invalid_config(self):
26 """
27 Tests whether an invalid config is validated properly.
28 """
29 cfg = CloudManConfig()
30 result = cfg.validate()
31 self.assertIsNotNone(result, "Validation should have returned a value since the configuration was invalid!")
32
33 def test_launch_and_terminate(self):
34 cls = TestCloudmanLaunch
35 cfg = CloudManConfig(cls.access_key, cls.secret_key, cls.cluster_name, cls.ami_id, cls.instance_type, cls.password, cloud_metadata=cls.cloud_metadata)
36 cmi = CloudManInstance.launch_instance(cfg)
37 status = cmi.get_status()
38 self.assertNotEqual(status['cluster_status'], 'ERROR', "instance.get_status() returned ERROR. Should return a successful status!")
39 try:
40 # TODO: The terminate method is unpredictable! Needs fix.
41 result = cmi.terminate(delete_cluster=True)
42 self.assertEqual(result['cluster_status'], 'SHUTDOWN', "Cluster should be in status SHUTDOWN after call to terminate!")
43 except Exception:
44 pass