Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/bioblend/_tests/TestCloudmanLaunch.py @ 2:6af9afd405e9 draft
"planemo upload commit 0a63dd5f4d38a1f6944587f52a8cd79874177fc1"
| author | shellac |
|---|---|
| date | Thu, 14 May 2020 14:56:58 -0400 |
| parents | 26e78fe6e8c4 |
| children |
comparison
equal
deleted
inserted
replaced
| 1:75ca89e9b81c | 2:6af9afd405e9 |
|---|---|
| 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 |
