|
| 1 | +import os |
| 2 | + |
| 3 | +from . import EnvironmentSetupTestBase, eco_utils |
| 4 | + |
| 5 | + |
| 6 | +class AzureTestBase(EnvironmentSetupTestBase): |
| 7 | + |
| 8 | + @property |
| 9 | + def node_type_prefix(self): |
| 10 | + return 'cloudify.azure.nodes' |
| 11 | + |
| 12 | + @property |
| 13 | + def plugin_mapping(self): |
| 14 | + return 'pkg' |
| 15 | + |
| 16 | + @property |
| 17 | + def blueprint_file_name(self): |
| 18 | + return 'azure.yaml' |
| 19 | + |
| 20 | + @property |
| 21 | + def external_id_key(self): |
| 22 | + return 'public_ip' |
| 23 | + |
| 24 | + @property |
| 25 | + def server_ip_property(self): |
| 26 | + return 'cloudify_host' |
| 27 | + |
| 28 | + @property |
| 29 | + def inputs(self): |
| 30 | + try: |
| 31 | + return { |
| 32 | + 'rpm': self.cloudify_rpm_url, |
| 33 | + 'password': self.password, |
| 34 | + 'location': 'westus', |
| 35 | + 'resource_prefix': 'ecotest', |
| 36 | + 'resource_suffix': self.application_prefix, |
| 37 | + 'subscription_id': os.environ['AZURE_SUB_ID'], |
| 38 | + 'tenant_id': os.environ['AZURE_TEN_ID'], |
| 39 | + 'client_id': os.environ['AZURE_CLI_ID'], |
| 40 | + 'client_secret': os.environ['AZURE_CLI_SE'], |
| 41 | + 'large_image_size': 'Standard_H8m' |
| 42 | + } |
| 43 | + except KeyError: |
| 44 | + raise |
| 45 | + |
| 46 | + @property |
| 47 | + def secrets_to_check(self): |
| 48 | + return [ |
| 49 | + 'agent_key_private', |
| 50 | + 'agent_key_public', |
| 51 | + 'azure_location', |
| 52 | + 'large_image_size', |
| 53 | + 'small_image_size', |
| 54 | + 'centos_core_image_version', |
| 55 | + 'centos_core_image_sku', |
| 56 | + 'centos_core_image_offer', |
| 57 | + 'centos_core_image_publisher', |
| 58 | + 'centos_core_image_offer', |
| 59 | + 'centos_core_image_publisher', |
| 60 | + 'ubuntu_trusty_image_version', |
| 61 | + 'centos_core_image_publisher', |
| 62 | + 'ubuntu_trusty_image_version', |
| 63 | + 'ubuntu_trusty_image_sku', |
| 64 | + 'ubuntu_trusty_image_offer', |
| 65 | + 'ubuntu_trusty_image_publisher', |
| 66 | + 'mgr_subnet_name', |
| 67 | + 'mgr_virtual_network_name', |
| 68 | + 'mgr_resource_group_name', |
| 69 | + 'azure_location', |
| 70 | + 'azure_client_secret', |
| 71 | + 'azure_client_id', |
| 72 | + 'azure_tenant_id', |
| 73 | + 'azure_subscription_id', |
| 74 | + 'location', |
| 75 | + 'client_secret', |
| 76 | + 'client_id', |
| 77 | + 'tenant_id', |
| 78 | + 'subscription_id', |
| 79 | + ] |
| 80 | + |
| 81 | + def test_network_deployment(self): |
| 82 | + self.addCleanup(self.cleanup_deployment, 'azure-example-network') |
| 83 | + # Create Deployment (Blueprint already uploaded.) |
| 84 | + _inputs = { |
| 85 | + 'resource_prefix': 'ecotestnet', |
| 86 | + 'resource_suffix': self.application_prefix |
| 87 | + } |
| 88 | + if eco_utils.create_deployment( |
| 89 | + 'azure-example-network', |
| 90 | + inputs=_inputs): |
| 91 | + raise Exception( |
| 92 | + 'Deployment azure-example-network failed.') |
| 93 | + # Install Deployment. |
| 94 | + if eco_utils.execute_install('azure-example-network'): |
| 95 | + raise Exception( |
| 96 | + 'Install azure-example-network failed.') |
| 97 | + if eco_utils.execute_uninstall('azure-example-network'): |
| 98 | + raise Exception('Uninstall azure-example-network failed.') |
| 99 | + |
| 100 | +class TestAzure432(AzureTestBase): |
| 101 | + pass |
| 102 | + |
| 103 | +class TestAzure1853(AzureTestBase): |
| 104 | + |
| 105 | + @property |
| 106 | + def cloudify_rpm_url(self): |
| 107 | + return 'http://repository.cloudifysource.org/cloudify/' \ |
| 108 | + '18.5.3/community-release/' \ |
| 109 | + 'cloudify-manager-install-community-18.5.3.rpm' |
0 commit comments