Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 04734a0

Browse files
author
earthmant
committed
Merge branch 'dev' into latest
2 parents 66d0b15 + 85c8972 commit 04734a0

6 files changed

Lines changed: 437 additions & 416 deletions

File tree

.circleci/config.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ jobs:
3939
command: pip install cloudify==4.3.2
4040
- run:
4141
name: install test requirements
42-
command: pip install nose https://github.com/cloudify-incubator/cloudify-awssdk-plugin/archive/2.3.4.zip https://github.com/cloudify-cosmo/cloudify-fabric-plugin/archive/1.5.1.zip https://github.com/cloudify-incubator/cloudify-utilities-plugin/archive/1.7.1.zip https://github.com/cloudify-incubator/cloudify-ecosystem-test/archive/2.0.zip
42+
command: pip install nose https://github.com/cloudify-incubator/cloudify-awssdk-plugin/archive/2.3.4.zip https://github.com/cloudify-cosmo/cloudify-fabric-plugin/archive/1.5.1.zip https://github.com/cloudify-incubator/cloudify-utilities-plugin/archive/1.7.1.zip https://github.com/cloudify-incubator/cloudify-ecosystem-test/archive/2.1.1.zip
4343
- run:
44-
name: execute test
45-
command: nosetests -s tests/test_env.py:TestAWS
44+
name: test 4.3.2
45+
command: nosetests -s tests/test_aws.py:TestAWS432
46+
- run:
47+
name: test 18.5.3
48+
command: nosetests -s tests/test_aws.py:TestAWS1853
4649

4750
azure:
4851
docker:
@@ -72,10 +75,13 @@ jobs:
7275
command: pip install cloudify==4.3.2
7376
- run:
7477
name: install test requirements
75-
command: pip install nose https://github.com/cloudify-incubator/cloudify-azure-plugin/archive/1.7.2.zip https://github.com/cloudify-cosmo/cloudify-fabric-plugin/archive/1.5.1.zip https://github.com/cloudify-incubator/cloudify-utilities-plugin/archive/1.7.1.zip https://github.com/cloudify-incubator/cloudify-ecosystem-test/archive/2.0.zip
78+
command: pip install nose https://github.com/cloudify-incubator/cloudify-azure-plugin/archive/1.7.2.zip https://github.com/cloudify-cosmo/cloudify-fabric-plugin/archive/1.5.1.zip https://github.com/cloudify-incubator/cloudify-utilities-plugin/archive/1.7.1.zip https://github.com/cloudify-incubator/cloudify-ecosystem-test/archive/2.1.1.zip
79+
- run:
80+
name: test 4.3.2
81+
command: nosetests -s tests/test_azure.py:TestAzure432
7682
- run:
77-
name: execute test
78-
command: nosetests -s tests/test_env.py:TestAzure
83+
name: test 18.5.3
84+
command: nosetests -s tests/test_azure.py:TestAzure1853
7985

8086
gcp:
8187
docker:
@@ -105,10 +111,13 @@ jobs:
105111
command: pip install cloudify==4.3.2
106112
- run:
107113
name: install test requirements
108-
command: pip install nose https://github.com/cloudify-cosmo/cloudify-gcp-plugin/archive/1.4.3.zip https://github.com/cloudify-cosmo/cloudify-fabric-plugin/archive/1.5.1.zip https://github.com/cloudify-incubator/cloudify-utilities-plugin/archive/1.7.1.zip https://github.com/cloudify-incubator/cloudify-ecosystem-test/archive/2.0.zip
114+
command: pip install nose https://github.com/cloudify-cosmo/cloudify-gcp-plugin/archive/1.4.3.zip https://github.com/cloudify-cosmo/cloudify-fabric-plugin/archive/1.5.1.zip https://github.com/cloudify-incubator/cloudify-utilities-plugin/archive/1.7.1.zip https://github.com/cloudify-incubator/cloudify-ecosystem-test/archive/2.1.1.zip
115+
- run:
116+
name: test 4.3.2
117+
command: nosetests -s tests/test_gcp.py:TestGCP432
109118
- run:
110-
name: execute test
111-
command: nosetests -s tests/test_env.py:TestGCP
119+
name: test 18.5.3
120+
command: nosetests -s tests/test_gcp.py:TestGCP1853
112121

113122
workflows:
114123
version: 2

tests/__init__.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Built-in Imports
2+
import os
3+
import sys
4+
5+
# Cloudify Imports
6+
from ecosystem_tests import (
7+
PasswordFilter,
8+
EcosystemTestBase,
9+
utils as eco_utils)
10+
11+
12+
class EnvironmentSetupTestBase(EcosystemTestBase):
13+
14+
def setUp(self):
15+
if self.password not in self.sensitive_data:
16+
self.sensitive_data.append(self.password)
17+
sys.stdout = PasswordFilter(self.sensitive_data, sys.stdout)
18+
sys.stderr = PasswordFilter(self.sensitive_data, sys.stderr)
19+
self.cfy_local = self.setup_cfy_local()
20+
if 'ECOSYSTEM_SESSION_MANAGER_IP' in os.environ:
21+
self.manager_ip = \
22+
os.environ['ECOSYSTEM_SESSION_MANAGER_IP']
23+
else:
24+
self.install_manager()
25+
self.initialize_manager_profile()
26+
27+
@property
28+
def manager_blueprint_version(self):
29+
if 'CIRCLE_BRANCH' in os.environ:
30+
return os.environ['CIRCLE_BRANCH']
31+
return os.environ.get('MANAGER_BLUEPRINT_VERSION', 'latest')
32+
33+
@property
34+
def blueprints_to_check(self):
35+
return [
36+
'aws-example-network',
37+
'azure-example-network',
38+
'gcp-example-network',
39+
'openstack-example-network',
40+
]
41+
42+
@property
43+
def cloudify_rpm_url(self):
44+
return 'http://repository.cloudifysource.org/cloudify/' \
45+
'4.3.2/ga-release/cloudify-manager-install-4.3.2ga.rpm'
46+
47+
@property
48+
def sensitive_data(self):
49+
50+
# We need to try returning all of these because
51+
# we have some common tests in this class.
52+
53+
try:
54+
55+
return [
56+
os.environ['AWS_SECRET_ACCESS_KEY'],
57+
os.environ['AWS_ACCESS_KEY_ID']
58+
]
59+
except KeyError:
60+
pass
61+
62+
try:
63+
return [
64+
os.environ['GCP_CERT_URL'],
65+
os.environ['GCP_EMAIL'],
66+
os.environ['GCP_CLIENT_ID'],
67+
os.environ['GCP_PRIVATE_PROJECT_ID'],
68+
os.environ['GCP_PRIVATE_KEY_ID'],
69+
os.environ['GCP_PRIVATE_KEY'],
70+
os.environ['GCP_PRIVATE_KEY'].decode('string_escape')
71+
]
72+
except KeyError:
73+
pass
74+
75+
try:
76+
return [
77+
os.environ['AZURE_SUB_ID'],
78+
os.environ['AZURE_TEN_ID'],
79+
os.environ['AZURE_CLI_ID'],
80+
os.environ['AZURE_CLI_SE']
81+
]
82+
except KeyError:
83+
raise
84+
85+
def test_secrets(self):
86+
for secret in self.secrets_to_check:
87+
self.assertIsNotNone(eco_utils.get_secrets(secret))
88+
89+
def test_blueprints(self):
90+
for blueprint in self.blueprints_to_check:
91+
try:
92+
eco_utils.get_client_response(
93+
'blueprints',
94+
'get',
95+
{'blueprint_id': blueprint})
96+
except:
97+
self.fail(
98+
'Blueprint {0} does not exist'.format(blueprint))

tests/test_aws.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import os
2+
3+
from . import EnvironmentSetupTestBase, eco_utils
4+
5+
6+
class AWSTestbase(EnvironmentSetupTestBase):
7+
8+
def setUp(self):
9+
os.environ['AWS_DEFAULT_REGION'] = \
10+
self.inputs.get('ec2_region_name')
11+
super(AWSTestbase, self).setUp()
12+
13+
@property
14+
def node_type_prefix(self):
15+
return 'cloudify.nodes.aws'
16+
17+
@property
18+
def plugin_mapping(self):
19+
return 'awssdk'
20+
21+
@property
22+
def blueprint_file_name(self):
23+
return 'aws.yaml'
24+
25+
@property
26+
def external_id_key(self):
27+
return 'aws_resource_id'
28+
29+
@property
30+
def server_ip_property(self):
31+
return 'ip'
32+
33+
@property
34+
def inputs(self):
35+
try:
36+
return {
37+
'rpm': self.cloudify_rpm_url,
38+
'password': os.environ['ECOSYSTEM_SESSION_PASSWORD'],
39+
'ec2_region_name': 'ap-southeast-1',
40+
'ec2_region_endpoint': 'ec2.ap-southeast-1.amazonaws.com',
41+
'availability_zone': 'ap-southeast-1b',
42+
'aws_secret_access_key': os.environ['AWS_SECRET_ACCESS_KEY'],
43+
'aws_access_key_id': os.environ['AWS_ACCESS_KEY_ID']
44+
}
45+
except KeyError:
46+
raise
47+
48+
@property
49+
def secrets_to_check(self):
50+
return [
51+
'agent_key_private',
52+
'agent_key_public',
53+
'centos_core_image',
54+
'ubuntu_trusty_image',
55+
'availability_zone',
56+
'private_subnet_id',
57+
'public_subnet_id',
58+
'vpc_id',
59+
'ec2_region_endpoint',
60+
'ec2_region_name',
61+
'aws_secret_access_key',
62+
'aws_access_key_id',
63+
]
64+
65+
def test_network_deployment(self):
66+
self.addCleanup(self.cleanup_deployment, 'aws-example-network')
67+
# Create Deployment (Blueprint already uploaded.)
68+
if eco_utils.create_deployment('aws-example-network'):
69+
raise Exception(
70+
'Deployment aws-example-network failed.')
71+
# Install Deployment.
72+
if eco_utils.execute_install('aws-example-network'):
73+
raise Exception(
74+
'Install aws-example-network failed.')
75+
if eco_utils.execute_uninstall('aws-example-network'):
76+
raise Exception('Uninstall aws-example-network failed.')
77+
78+
class TestAWS432(AWSTestbase):
79+
pass
80+
81+
class TestAWS1853(AWSTestbase):
82+
83+
@property
84+
def cloudify_rpm_url(self):
85+
return 'http://repository.cloudifysource.org/cloudify/' \
86+
'18.5.3/community-release/' \
87+
'cloudify-manager-install-community-18.5.3.rpm'

tests/test_azure.py

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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

Comments
 (0)