summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhurong <aaronzhu1121@gmail.com>2017-12-04 15:18:38 +0800
committerzhurong <aaronzhu1121@gmail.com>2017-12-07 02:03:48 +0000
commit1ea1cda5d47718a537f5e476426400bd1937ec92 (patch)
tree02bf0e0d622a59308b3d458163066aaa160f2b51
parent05d95df793530c6957b597fa1a9d67b5a1c7be23 (diff)
Remove murano_tempest_tests from murano repo
Notes
Notes (review): Code-Review+2: Felipe Monteiro <felipe.monteiro@att.com> Code-Review+2: zhurong <aaronzhu1121@gmail.com> Workflow+1: zhurong <aaronzhu1121@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 07 Dec 2017 03:43:21 +0000 Reviewed-on: https://review.openstack.org/525083 Project: openstack/murano Branch: refs/heads/master
-rw-r--r--murano/tests/unit/engine/test_package_loader.py2
-rw-r--r--murano/tests/unit/utils.py82
-rw-r--r--murano_tempest_tests/__init__.py0
-rw-r--r--murano_tempest_tests/clients.py72
-rw-r--r--murano_tempest_tests/config.py132
-rw-r--r--murano_tempest_tests/extras/MockApp/Classes/mock_muranopl.yaml47
-rw-r--r--murano_tempest_tests/extras/MockApp/UI/ui.yaml22
-rw-r--r--murano_tempest_tests/extras/MockApp/logo.pngbin22607 -> 0 bytes
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/Classes/ApacheHttpServer.yaml81
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/Resources/index.html8
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/manifest.yaml28
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Classes/Lighttpd.yaml55
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Resources/DeployLighttpd.template27
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Resources/scripts/deployLighttpd.sh14
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/manifest.yaml24
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/Classes/UpdateExecutor.yaml47
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/Resources/scripts/update.sh14
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/manifest.yaml22
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.VM/Classes/VM.yaml66
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.VM/Resources/index.html8
-rw-r--r--murano_tempest_tests/extras/io.murano.apps.test.VM/manifest.yaml22
-rw-r--r--murano_tempest_tests/plugin.py54
-rw-r--r--murano_tempest_tests/services/__init__.py0
-rw-r--r--murano_tempest_tests/services/application_catalog/__init__.py0
-rw-r--r--murano_tempest_tests/services/application_catalog/application_catalog_client.py449
-rw-r--r--murano_tempest_tests/services/artifacts/__init__.py0
-rw-r--r--murano_tempest_tests/services/artifacts/artifacts_client.py157
-rw-r--r--murano_tempest_tests/services/service_broker/__init__.py0
-rw-r--r--murano_tempest_tests/services/service_broker/service_broker_client.py108
-rw-r--r--murano_tempest_tests/tests/__init__.py0
-rw-r--r--murano_tempest_tests/tests/api/__init__.py0
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/__init__.py0
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/artifacts/__init__.py0
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/artifacts/base.py97
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/artifacts/test_repository.py56
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning.py166
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning_negative.py96
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/base.py110
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_categories.py113
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_categories_negative.py72
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_deployments.py86
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_env_templates.py258
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_env_templates_negative.py133
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_environments.py128
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_environments_negative.py104
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_repository.py221
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_repository_negative.py193
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_services.py134
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_services_negative.py272
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_sessions.py93
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_sessions_negative.py146
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_static_actions.py76
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_static_actions_negative.py115
-rw-r--r--murano_tempest_tests/tests/api/service_broker/__init__.py0
-rw-r--r--murano_tempest_tests/tests/api/service_broker/base.py136
-rw-r--r--murano_tempest_tests/tests/api/service_broker/test_service_broker_actions.py167
-rw-r--r--murano_tempest_tests/tests/api/service_broker/test_service_broker_negative.py32
-rw-r--r--murano_tempest_tests/tests/scenario/__init__.py0
-rw-r--r--murano_tempest_tests/tests/scenario/application_catalog/__init__.py0
-rw-r--r--murano_tempest_tests/tests/scenario/application_catalog/base.py406
-rw-r--r--murano_tempest_tests/tests/scenario/application_catalog/test_cinder_volumes.py510
-rw-r--r--murano_tempest_tests/tests/scenario/application_catalog/test_deployment.py257
-rw-r--r--murano_tempest_tests/tests/scenario/application_catalog/test_security_groups.py85
-rw-r--r--murano_tempest_tests/utils.py512
64 files changed, 83 insertions, 6232 deletions
diff --git a/murano/tests/unit/engine/test_package_loader.py b/murano/tests/unit/engine/test_package_loader.py
index 86badbd..ad3a0ce 100644
--- a/murano/tests/unit/engine/test_package_loader.py
+++ b/murano/tests/unit/engine/test_package_loader.py
@@ -28,7 +28,7 @@ from murano.dsl import murano_package as dsl_package
28from murano.engine import package_loader 28from murano.engine import package_loader
29from murano.packages import exceptions as pkg_exc 29from murano.packages import exceptions as pkg_exc
30from murano.tests.unit import base 30from murano.tests.unit import base
31from murano_tempest_tests import utils 31from murano.tests.unit import utils
32 32
33 33
34class TestPackageCache(base.MuranoTestCase): 34class TestPackageCache(base.MuranoTestCase):
diff --git a/murano/tests/unit/utils.py b/murano/tests/unit/utils.py
index 0a04597..8785500 100644
--- a/murano/tests/unit/utils.py
+++ b/murano/tests/unit/utils.py
@@ -13,10 +13,21 @@
13# See the License for the specific language governing permissions and 13# See the License for the specific language governing permissions and
14# limitations under the License. 14# limitations under the License.
15 15
16import os
17import shutil
18import yaml
19import zipfile
20
16from murano import context 21from murano import context
17from murano.db import session 22from murano.db import session
18 23
19 24
25MANIFEST = {'Format': 'MuranoPL/1.0',
26 'Type': 'Application',
27 'Description': 'MockApp for API tests',
28 'Author': 'Mirantis, Inc'}
29
30
20def dummy_context(user='test_username', tenant_id='test_tenant_id', 31def dummy_context(user='test_username', tenant_id='test_tenant_id',
21 request_id='dummy-request', **kwargs): 32 request_id='dummy-request', **kwargs):
22 33
@@ -35,3 +46,74 @@ def save_models(*models):
35 s = session.get_session() 46 s = session.get_session()
36 for m in models: 47 for m in models:
37 m.save(s) 48 m.save(s)
49
50
51def compose_package(app_name, package_dir,
52 require=None, archive_dir=None, add_class_name=False,
53 manifest_required=True, version=None):
54 """Composes a murano package
55
56 Composes package `app_name` manifest and files from `package_dir`.
57 Includes `require` section if any in the manifest file.
58 Puts the resulting .zip file into `archive_dir` if present or in the
59 `package_dir`.
60 """
61 tmp_package_dir = os.path.join(archive_dir, os.path.basename(package_dir))
62 shutil.copytree(package_dir, tmp_package_dir)
63 package_dir = tmp_package_dir
64
65 if manifest_required:
66 manifest = os.path.join(package_dir, "manifest.yaml")
67 with open(manifest, 'w') as f:
68 fqn = 'io.murano.apps.' + app_name
69 mfest_copy = MANIFEST.copy()
70 mfest_copy['FullName'] = fqn
71 mfest_copy['Name'] = app_name
72 mfest_copy['Classes'] = {fqn: 'mock_muranopl.yaml'}
73 if require:
74 mfest_copy['Require'] = {str(name): version
75 for name, version in require}
76 if version:
77 mfest_copy['Version'] = version
78 f.write(yaml.dump(mfest_copy, default_flow_style=False))
79
80 if add_class_name:
81 class_file = os.path.join(package_dir, 'Classes', 'mock_muranopl.yaml')
82 with open(class_file, 'r') as f:
83 contents = f.read()
84
85 index = contents.index('Extends')
86 contents = "{0}Name: {1}\n\n{2}".format(contents[:index], app_name,
87 contents[index:])
88 with open(class_file, 'w') as f:
89 f.write(contents)
90
91 if require:
92 class_file = os.path.join(package_dir, 'Classes', 'mock_muranopl.yaml')
93 with open(class_file, 'r') as f:
94 content = f.read()
95
96 index_string = 'deploy:\n Body:\n '
97 index = content.index(index_string) + len(index_string)
98 class_names = [req[0][req[0].rfind('.') + 1:] for req in require]
99 addition = "".join(["- new({})\n".format(name) + ' ' * 6
100 for name in class_names])
101 content = content[:index] + addition + content[index:]
102 with open(class_file, 'w') as f:
103 f.write(content)
104
105 name = app_name + '.zip'
106
107 if not archive_dir:
108 archive_dir = os.path.dirname(os.path.abspath(__file__))
109 archive_path = os.path.join(archive_dir, name)
110
111 with zipfile.ZipFile(archive_path, 'w') as zip_file:
112 for root, dirs, files in os.walk(package_dir):
113 for f in files:
114 zip_file.write(
115 os.path.join(root, f),
116 arcname=os.path.join(os.path.relpath(root, package_dir), f)
117 )
118
119 return archive_path, name
diff --git a/murano_tempest_tests/__init__.py b/murano_tempest_tests/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/murano_tempest_tests/__init__.py
+++ /dev/null
diff --git a/murano_tempest_tests/clients.py b/murano_tempest_tests/clients.py
deleted file mode 100644
index 08d42f1..0000000
--- a/murano_tempest_tests/clients.py
+++ /dev/null
@@ -1,72 +0,0 @@
1# Copyright (c) 2015 Mirantis, Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.common import credentials_factory as common_creds
17from tempest import config
18from tempest.lib import auth
19
20from murano_tempest_tests.services.application_catalog \
21 import application_catalog_client
22from murano_tempest_tests.services.artifacts import artifacts_client
23from murano_tempest_tests.services.service_broker import service_broker_client
24
25CONF = config.CONF
26
27
28class Manager(object):
29 def __init__(self,
30 credentials=None):
31 if credentials is None:
32 credentials = common_creds.\
33 get_configured_admin_credentials('identity_admin')
34 self.auth_provider = get_auth_provider(credentials)
35 self.service_broker_client = service_broker_client.ServiceBrokerClient(
36 self.auth_provider)
37 if CONF.application_catalog.glare_backend:
38 self.artifacts_client = artifacts_client.ArtifactsClient(
39 self.auth_provider)
40 else:
41 self.artifacts_client = None
42 self.application_catalog_client = \
43 application_catalog_client.ApplicationCatalogClient(
44 self.auth_provider)
45
46
47class AltManager(Manager):
48 def __init__(self, service=None):
49 super(AltManager, self).__init__(
50 common_creds.get_configured_admin_credentials('alt_user'), service)
51
52
53def get_auth_provider(credentials, scope='project'):
54 default_params = {
55 'disable_ssl_certificate_validation':
56 CONF.identity.disable_ssl_certificate_validation,
57 'ca_certs': CONF.identity.ca_certificates_file,
58 'trace_requests': CONF.debug.trace_requests
59 }
60
61 if isinstance(credentials, auth.KeystoneV3Credentials):
62 auth_provider_class, auth_url = \
63 auth.KeystoneV3AuthProvider, CONF.identity.uri_v3
64 else:
65 auth_provider_class, auth_url = \
66 auth.KeystoneV2AuthProvider, CONF.identity.uri
67
68 _auth_provider = auth_provider_class(credentials, auth_url,
69 scope=scope,
70 **default_params)
71 _auth_provider.set_auth()
72 return _auth_provider
diff --git a/murano_tempest_tests/config.py b/murano_tempest_tests/config.py
deleted file mode 100644
index e00cdbf..0000000
--- a/murano_tempest_tests/config.py
+++ /dev/null
@@ -1,132 +0,0 @@
1# Copyright (c) 2015 Mirantis, Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from oslo_config import cfg
17
18service_option = [
19 cfg.BoolOpt("murano",
20 default=True,
21 help="Whether or not murano is expected to be available"),
22 cfg.BoolOpt("murano_cfapi",
23 default=False,
24 help="Whether or not murano-cfapi is expected to be "
25 "unavailable by default"),
26 cfg.BoolOpt("glare",
27 default=False,
28 help="Whether or not glare is expected to be unavailable")
29]
30
31application_catalog_group = cfg.OptGroup(name="application_catalog",
32 title="Application Catalog Options")
33
34service_broker_group = cfg.OptGroup(name="service_broker",
35 title="Service Broker Options")
36
37artifacts_group = cfg.OptGroup(name="artifacts",
38 title="Glance Artifacts Options")
39
40ApplicationCatalogGroup = [
41 # Application catalog tempest configuration
42 cfg.StrOpt("region",
43 default="",
44 help="The application_catalog region name to use. If empty, "
45 "the value of identity.region is used instead. "
46 "If no such region is found in the service catalog, "
47 "the first found one is used."),
48
49 cfg.StrOpt("linux_image",
50 default="debian-8-m-agent.qcow2",
51 help="Image for linux services"),
52
53 cfg.StrOpt("catalog_type",
54 default="application-catalog",
55 help="Catalog type of Application Catalog."),
56
57 cfg.StrOpt("endpoint_type",
58 default="publicURL",
59 choices=["publicURL", "adminURL", "internalURL"],
60 help="The endpoint type for application catalog service."),
61
62 cfg.IntOpt("build_interval",
63 default=3,
64 help="Time in seconds between application catalog"
65 " availability checks."),
66
67 cfg.IntOpt("build_timeout",
68 default=500,
69 help="Timeout in seconds to wait for a application catalog"
70 " to become available."),
71 cfg.BoolOpt("glare_backend",
72 default=False,
73 help="Tells tempest about murano glare backend "
74 "configuration."),
75 cfg.BoolOpt("cinder_volume_tests",
76 default=False,
77 help="Whether or not cinder volumes attachment tests "
78 "are expected to run"),
79 cfg.BoolOpt("deployment_tests",
80 default=False,
81 help="Whether or not deployment tests are expected to run")
82]
83
84ServiceBrokerGroup = [
85 # Test runs control
86 cfg.BoolOpt("run_service_broker_tests",
87 default=False,
88 help="Defines whether run service broker api tests or not"),
89
90 cfg.StrOpt("catalog_type",
91 default="service-broker",
92 help="Catalog type of Service Broker API"),
93
94 cfg.StrOpt("endpoint_type",
95 default="publicURL",
96 choices=["publicURL", "adminURL", "internalURL"],
97 help="The endpoint type for service broker service"),
98
99 cfg.IntOpt("build_interval",
100 default=3,
101 help="Time in seconds between service broker"
102 " availability checks."),
103
104 cfg.IntOpt("build_timeout",
105 default=500,
106 help="Timeout in seconds to wait for a service broker"
107 " to become available.")
108
109
110]
111
112ArtifactsGroup = [
113 # Glance artifacts options
114 cfg.StrOpt("catalog_type",
115 default="artifact",
116 help="Catalog type of Artifacts API"),
117
118 cfg.StrOpt("endpoint_type",
119 default="publicURL",
120 choices=["publicURL", "adminURL", "internalURL"],
121 help="The endpoint type for artifacts service"),
122
123 cfg.IntOpt("build_interval",
124 default=3,
125 help="Time in seconds between artifacts"
126 " availability checks."),
127
128 cfg.IntOpt("build_timeout",
129 default=500,
130 help="Timeout in seconds to wait for a artifacts"
131 " to become available.")
132]
diff --git a/murano_tempest_tests/extras/MockApp/Classes/mock_muranopl.yaml b/murano_tempest_tests/extras/MockApp/Classes/mock_muranopl.yaml
deleted file mode 100644
index c89de41..0000000
--- a/murano_tempest_tests/extras/MockApp/Classes/mock_muranopl.yaml
+++ /dev/null
@@ -1,47 +0,0 @@
1Namespaces:
2 =: io.murano.apps
3 std: io.murano
4
5Extends: std:Application
6
7Properties:
8
9 userName:
10 Contract: $.string()
11
12 greeting:
13 Usage: Static
14 Contract: $.string()
15 Default: 'Hello, '
16
17Methods:
18 testAction:
19 Scope: Public
20 Body:
21 - $this.find(std:Environment).reporter.report($this, 'Completed')
22 getCredentials:
23 Scope: Public
24 Body:
25 - Return:
26 credentials:
27 uri: localhost
28 deploy:
29 Body:
30 - $this.find(std:Environment).reporter.report($this, 'Follow the white rabbit')
31
32 staticAction:
33 Scope: Public
34 Usage: Static
35 Arguments:
36 - myName:
37 Contract: $.string().notNull()
38 Body:
39 - Return: concat($.greeting, $myName)
40
41 staticNotAction:
42 Usage: Static
43 Arguments:
44 - myName:
45 Contract: $.string().notNull()
46 Body:
47 - Return: concat($.greeting, $myName)
diff --git a/murano_tempest_tests/extras/MockApp/UI/ui.yaml b/murano_tempest_tests/extras/MockApp/UI/ui.yaml
deleted file mode 100644
index 6f1cda4..0000000
--- a/murano_tempest_tests/extras/MockApp/UI/ui.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13Version: 2.2
14
15Forms:
16 - appConfiguration:
17 fields:
18 - name: license
19 type: string
20 description: Apache License, Version 2.0
21 hidden: false
22 required: false
diff --git a/murano_tempest_tests/extras/MockApp/logo.png b/murano_tempest_tests/extras/MockApp/logo.png
deleted file mode 100644
index ab7ca2c..0000000
--- a/murano_tempest_tests/extras/MockApp/logo.png
+++ /dev/null
Binary files differ
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/Classes/ApacheHttpServer.yaml b/murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/Classes/ApacheHttpServer.yaml
deleted file mode 100644
index cd13ff9..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/Classes/ApacheHttpServer.yaml
+++ /dev/null
@@ -1,81 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13Namespaces:
14 =: io.murano.apps.test
15 std: io.murano
16 res: io.murano.resources
17 sys: io.murano.system
18 conf: io.murano.configuration
19
20
21Name: ApacheHttpServerCustom
22
23Extends: std:Application
24
25Properties:
26 name:
27 Contract: $.string().notNull()
28
29 instance:
30 Contract: $.class(res:Instance).notNull()
31
32 userName:
33 Contract: $.string()
34
35Methods:
36 initialize:
37 Body:
38 - $._environment: $.find(std:Environment).require()
39
40 deploy:
41 Body:
42 - If: not $.getAttr(deployed, false)
43 Then:
44 - $._environment.reporter.report($this, 'Creating VM for Apache Server.')
45 - $securityGroupIngress:
46 - ToPort: 80
47 FromPort: 80
48 IpProtocol: tcp
49 External: true
50 - ToPort: 443
51 FromPort: 443
52 IpProtocol: tcp
53 External: true
54 - $._environment.securityGroupManager.addGroupIngress($securityGroupIngress)
55 - $.instance.deploy()
56 - $._environment.reporter.report($this, 'Instance is created. Deploying Apache')
57
58 - $resources: new(sys:Resources)
59 - $linux: new(conf:Linux)
60
61 - $linux.runCommand($.instance.agent, 'apt-get -y install apache2')
62 - $linux.runCommand($.instance.agent, 'iptables -I INPUT 1 -p tcp --dport 443 -j ACCEPT')
63 - $linux.runCommand($.instance.agent, 'iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT')
64 - $._environment.reporter.report($this, 'Apache is installed.')
65
66 - If: $.userName != ''
67 Then:
68 - $linux.runCommand($.instance.agent, 'service apache2 stop')
69 - $fileReplacements:
70 "%USER_NAME%": $.userName
71 - $fileContent: $resources.string('index.html').replace($fileReplacements)
72 - $linux.putFile($.instance.agent, $fileContent, '/var/www/html/index.html')
73 - $linux.runCommand($.instance.agent, 'service apache2 start')
74
75 - If: $.instance.assignFloatingIp
76 Then:
77 - $host: $.instance.floatingIpAddress
78 Else:
79 - $host: $.instance.ipAddresses[0]
80 - $._environment.reporter.report($this, format('Apache is available at http://{0}', $host))
81 - $.setAttr(deployed, true)
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/Resources/index.html b/murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/Resources/index.html
deleted file mode 100644
index 6843697..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/Resources/index.html
+++ /dev/null
@@ -1,8 +0,0 @@
1<!DOCTYPE html>
2<html>
3<head>
4<title> Hello World</title>
5</head>
6<body>Hello world. This is my first web page. My name is %USER_NAME%.
7</body>
8</html>
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/manifest.yaml b/murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/manifest.yaml
deleted file mode 100644
index b0ab7c3..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.ApacheHttpServerCustom/manifest.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13Format: 1.0
14Type: Application
15FullName: io.murano.test.apache.ApacheHttpServerCustom
16Name: Apache HTTP Server Custom
17Description: |
18 The Apache HTTP Server Project is an effort to develop and maintain an
19 open-source HTTP server for modern operating systems including UNIX and
20 Windows NT. The goal of this project is to provide a secure, efficient and
21 extensible server that provides HTTP services in sync with the current HTTP
22 standards.
23 Apache httpd has been the most popular web server on the Internet since
24 April 1996, and celebrated its 17th birthday as a project this February.
25Author: 'Mirantis, Inc'
26Tags: [HTTP, Server, WebServer, HTML, Apache]
27Classes:
28 io.murano.apps.test.ApacheHttpServerCustom: ApacheHttpServer.yaml
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Classes/Lighttpd.yaml b/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Classes/Lighttpd.yaml
deleted file mode 100644
index c719f12..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Classes/Lighttpd.yaml
+++ /dev/null
@@ -1,55 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13Namespaces:
14 =: io.murano.apps.test
15 std: io.murano
16 sys: io.murano.system
17
18Name: Lighttpd
19
20Extends: std:Application
21
22Properties:
23 updater:
24 Contract: $.class(UpdateExecutor).notNull()
25
26Methods:
27 initialize:
28 Body:
29 - $._environment: $.find(std:Environment).require()
30
31 deploy:
32 Body:
33 - If: not $.getAttr(deployed, false)
34 Then:
35 - $securityGroupIngress:
36 - ToPort: 80
37 FromPort: 80
38 IpProtocol: tcp
39 External: true
40 - ToPort: 443
41 FromPort: 443
42 IpProtocol: tcp
43 External: true
44 - $._environment.securityGroupManager.addGroupIngress($securityGroupIngress)
45 - $._environment.reporter.report($this, 'Ensuring Updater is deployed.')
46 - $.updater.deploy()
47 - $resources: new(sys:Resources)
48 - $template: $resources.yaml('DeployLighttpd.template')
49 - $.updater.instance.agent.call($template, $resources)
50
51 - If: $.updater.instance.assignFloatingIp
52 Then:
53 - $address: $.updater.instance.floatingIpAddress
54 - $._environment.reporter.report($this, format('Running at http://{0}', $address))
55 - $.setAttr(deployed, true)
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Resources/DeployLighttpd.template b/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Resources/DeployLighttpd.template
deleted file mode 100644
index 7eba0d5..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Resources/DeployLighttpd.template
+++ /dev/null
@@ -1,27 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13FormatVersion: 2.0.0
14Version: 1.0.0
15Name: Deploy Lighttpd
16
17Body: |
18 deploy()
19
20Scripts:
21 deploy:
22 Type: Application
23 Version: 1.0.0
24 EntryPoint: deployLighttpd.sh
25 Options:
26 captureStdout: true
27 captureStderr: true
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Resources/scripts/deployLighttpd.sh b/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Resources/scripts/deployLighttpd.sh
deleted file mode 100644
index 09dcd46..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/Resources/scripts/deployLighttpd.sh
+++ /dev/null
@@ -1,14 +0,0 @@
1#!/bin/bash
2# Licensed under the Apache License, Version 2.0 (the "License"); you may
3# not use this file except in compliance with the License. You may obtain
4# a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11# License for the specific language governing permissions and limitations
12# under the License.
13
14sudo apt-get -y -q install lighttpd
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/manifest.yaml b/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/manifest.yaml
deleted file mode 100644
index 5bdb902..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.Lighttpd/manifest.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13Format: 1.0
14Type: Application
15FullName: io.murano.apps.test.Lighttpd
16Name: Lighttpd
17Description: |
18 Lighttpd... :)
19Author: 'Mirantis, Inc'
20Tags: [Web]
21Classes:
22 io.murano.apps.test.Lighttpd: Lighttpd.yaml
23Require:
24 io.murano.apps.test.UpdateExecutor:
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/Classes/UpdateExecutor.yaml b/murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/Classes/UpdateExecutor.yaml
deleted file mode 100644
index fd47e88..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/Classes/UpdateExecutor.yaml
+++ /dev/null
@@ -1,47 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13Namespaces:
14 =: io.murano.apps.test
15 std: io.murano
16 res: io.murano.resources
17 sys: io.murano.system
18 conf: io.murano.configuration
19
20
21Name: UpdateExecutor
22
23Extends: std:Application
24
25Properties:
26 name:
27 Contract: $.string().notNull()
28
29 instance:
30 Contract: $.class(res:Instance).notNull()
31
32Methods:
33 initialize:
34 Body:
35 - $._environment: $.find(std:Environment).require()
36
37 deploy:
38 Body:
39 - If: not $.getAttr(deployed, false)
40 Then:
41 - $._environment.reporter.report($this, 'Creating VM.')
42 - $.instance.deploy()
43 - $._environment.reporter.report($this, 'Starting packages updating.')
44 - $file: sys:Resources.string('scripts/update.sh')
45 - conf:Linux.runCommand($.instance.agent, $file)
46 - $._environment.reporter.report($this, 'Update completed.')
47 - $.setAttr(deployed, true)
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/Resources/scripts/update.sh b/murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/Resources/scripts/update.sh
deleted file mode 100644
index 28cddd5..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/Resources/scripts/update.sh
+++ /dev/null
@@ -1,14 +0,0 @@
1#!/bin/bash
2# Licensed under the Apache License, Version 2.0 (the "License"); you may
3# not use this file except in compliance with the License. You may obtain
4# a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11# License for the specific language governing permissions and limitations
12# under the License.
13
14sudo apt-get update
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/manifest.yaml b/murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/manifest.yaml
deleted file mode 100644
index 49137b4..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.UpdateExecutor/manifest.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13Format: 1.0
14Type: Application
15FullName: io.murano.apps.test.UpdateExecutor
16Name: Update Executor
17Description: |
18 Test application, which updates packages on VM
19Author: 'Mirantis, Inc'
20Tags: [application]
21Classes:
22 io.murano.apps.test.UpdateExecutor: UpdateExecutor.yaml
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.VM/Classes/VM.yaml b/murano_tempest_tests/extras/io.murano.apps.test.VM/Classes/VM.yaml
deleted file mode 100644
index 4782294..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.VM/Classes/VM.yaml
+++ /dev/null
@@ -1,66 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13Namespaces:
14 =: io.murano.apps.test
15 std: io.murano
16 res: io.murano.resources
17 sys: io.murano.system
18 conf: io.murano.configuration
19
20
21Name: VM
22
23Extends: std:Application
24
25Properties:
26 name:
27 Contract: $.string().notNull()
28
29 instance:
30 Contract: $.class(res:Instance).notNull()
31
32 userName:
33 Contract: $.string()
34
35Methods:
36 initialize:
37 Body:
38 - $._environment: $.find(std:Environment).require()
39
40 deploy:
41 Body:
42 - If: not $.getAttr(deployed, false)
43 Then:
44 - $._environment.reporter.report($this, 'Creating VM')
45 - $securityGroupIngress:
46 - ToPort: 80
47 FromPort: 80
48 IpProtocol: tcp
49 External: true
50 - ToPort: 443
51 FromPort: 443
52 IpProtocol: tcp
53 External: true
54 - $._environment.securityGroupManager.addGroupIngress($securityGroupIngress)
55 - $.instance.deploy()
56 - $._environment.reporter.report($this, 'Instance is created.')
57
58 - $resources: new(sys:Resources)
59 - $linux: new(conf:Linux)
60
61 - If: $.instance.assignFloatingIp
62 Then:
63 - $host: $.instance.floatingIpAddress
64 Else:
65 - $host: $.instance.ipAddresses[0]
66 - $.setAttr(deployed, true)
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.VM/Resources/index.html b/murano_tempest_tests/extras/io.murano.apps.test.VM/Resources/index.html
deleted file mode 100644
index 6843697..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.VM/Resources/index.html
+++ /dev/null
@@ -1,8 +0,0 @@
1<!DOCTYPE html>
2<html>
3<head>
4<title> Hello World</title>
5</head>
6<body>Hello world. This is my first web page. My name is %USER_NAME%.
7</body>
8</html>
diff --git a/murano_tempest_tests/extras/io.murano.apps.test.VM/manifest.yaml b/murano_tempest_tests/extras/io.murano.apps.test.VM/manifest.yaml
deleted file mode 100644
index 7b1a21c..0000000
--- a/murano_tempest_tests/extras/io.murano.apps.test.VM/manifest.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13Format: 1.0
14Type: Application
15FullName: io.murano.test.VM.VM
16Name: VM
17Description: |
18 application which simply boot a virtual machine
19Author: 'Mirantis, Inc'
20Tags: [Server]
21Classes:
22 io.murano.apps.test.VM: VM.yaml
diff --git a/murano_tempest_tests/plugin.py b/murano_tempest_tests/plugin.py
deleted file mode 100644
index 9231b09..0000000
--- a/murano_tempest_tests/plugin.py
+++ /dev/null
@@ -1,54 +0,0 @@
1# Copyright (c) 2015 Mirantis, Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16import os
17
18from tempest import config
19from tempest.test_discover import plugins
20
21from murano_tempest_tests import config as config_application_catalog
22
23
24class MuranoTempestPlugin(plugins.TempestPlugin):
25 def load_tests(self):
26 base_path = os.path.split(os.path.dirname(
27 os.path.abspath(__file__)))[0]
28 test_dir = "murano_tempest_tests/tests"
29 full_test_dir = os.path.join(base_path, test_dir)
30 return full_test_dir, base_path
31
32 def register_opts(self, conf):
33 config.register_opt_group(
34 conf, config.service_available_group,
35 config_application_catalog.service_option)
36 config.register_opt_group(
37 conf, config_application_catalog.application_catalog_group,
38 config_application_catalog.ApplicationCatalogGroup)
39 config.register_opt_group(
40 conf, config_application_catalog.service_broker_group,
41 config_application_catalog.ServiceBrokerGroup)
42 config.register_opt_group(
43 conf, config_application_catalog.artifacts_group,
44 config_application_catalog.ArtifactsGroup)
45
46 def get_opt_lists(self):
47 return [(config_application_catalog.application_catalog_group.name,
48 config_application_catalog.ApplicationCatalogGroup),
49 (config_application_catalog.service_broker_group.name,
50 config_application_catalog.ServiceBrokerGroup),
51 (config.service_available_group.name,
52 config_application_catalog.service_option),
53 (config_application_catalog.artifacts_group.name,
54 config_application_catalog.ArtifactsGroup)]
diff --git a/murano_tempest_tests/services/__init__.py b/murano_tempest_tests/services/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/murano_tempest_tests/services/__init__.py
+++ /dev/null
diff --git a/murano_tempest_tests/services/application_catalog/__init__.py b/murano_tempest_tests/services/application_catalog/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/murano_tempest_tests/services/application_catalog/__init__.py
+++ /dev/null
diff --git a/murano_tempest_tests/services/application_catalog/application_catalog_client.py b/murano_tempest_tests/services/application_catalog/application_catalog_client.py
deleted file mode 100644
index 3721850..0000000
--- a/murano_tempest_tests/services/application_catalog/application_catalog_client.py
+++ /dev/null
@@ -1,449 +0,0 @@
1# Copyright (c) 2015 Mirantis, Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16import json
17import os
18
19import requests
20from tempest import config
21from tempest.lib.common import rest_client
22
23from murano_tempest_tests import utils
24
25CONF = config.CONF
26
27
28class ApplicationCatalogClient(rest_client.RestClient):
29 """Tempest REST client for Murano Application Catalog"""
30
31 def __init__(self, auth_provider):
32 super(ApplicationCatalogClient, self).__init__(
33 auth_provider,
34 CONF.application_catalog.catalog_type,
35 CONF.identity.region,
36 endpoint_type=CONF.application_catalog.endpoint_type)
37 self.build_interval = CONF.application_catalog.build_interval
38 self.build_timeout = CONF.application_catalog.build_timeout
39
40# -----------------------------Packages methods--------------------------------
41 def upload_package(self, package_name, package_path, top_dir, body):
42 """Upload a Murano package into Murano repository
43
44 :param package_name: Package name
45 :param package_path: Path with .zip relatively top_dir
46 :param top_dir: Top directory with tests
47 :param body: dict of tags, parameters, etc
48 :return:
49 """
50 headers = {'X-Auth-Token': self.auth_provider.get_token()}
51 files = open(os.path.join(top_dir, package_path), 'rb')
52 uri = "/v1/catalog/packages"
53 post_body = {'JsonString': json.dumps(body)}
54 endpoint = self.base_url
55 url = endpoint + uri
56 resp = requests.post(url, files={package_name: files}, data=post_body,
57 headers=headers, timeout=self.build_timeout)
58 self.expected_success(200, resp.status_code)
59 return self._parse_resp(resp.text)
60
61 def update_package(self, package_id, post_body):
62 headers = {
63 'content-type': 'application/murano-packages-json-patch'
64 }
65
66 uri = 'v1/catalog/packages/{0}'.format(package_id)
67 resp, body = self.patch(uri, json.dumps(post_body), headers=headers)
68 self.expected_success(200, resp.status)
69 return self._parse_resp(body)
70
71 def delete_package(self, package_id):
72 """Removes a package from a repository
73
74 :param package_id: Package ID
75 """
76 uri = 'v1/catalog/packages/{0}'.format(package_id)
77 resp, body = self.delete(uri)
78 self.expected_success(200, resp.status)
79
80 def get_package(self, package_id):
81 uri = 'v1/catalog/packages/{0}'.format(package_id)
82 resp, body = self.get(uri)
83 self.expected_success(200, resp.status)
84 return self._parse_resp(body)
85
86 def get_list_packages(self):
87 uri = 'v1/catalog/packages'
88 resp, body = self.get(uri)
89 self.expected_success(200, resp.status)
90 return self._parse_resp(body)
91
92 def download_package(self, package_id):
93 headers = {
94 'content-type': 'application/octet-stream'
95 }
96 uri = 'v1/catalog/packages/{0}/download'.format(package_id)
97 resp, body = self.get(uri, headers=headers)
98 self.expected_success(200, resp.status)
99 return self._parse_resp(body)
100
101 def get_ui_definition(self, package_id):
102 headers = {
103 'content-type': 'application/octet-stream'
104 }
105 uri = 'v1/catalog/packages/{0}/ui'.format(package_id)
106 resp, body = self.get(uri, headers=headers)
107 self.expected_success(200, resp.status)
108 return self._parse_resp(body)
109
110 def get_logo(self, package_id):
111 headers = {
112 'content-type': 'application/octet-stream'
113 }
114 uri = 'v1/catalog/packages/{0}/ui'.format(package_id)
115 resp, body = self.get(uri, headers=headers)
116 self.expected_success(200, resp.status)
117 return self._parse_resp(body)
118
119# -----------------------Methods for environment CRUD--------------------------
120 def get_environments_list(self):
121 uri = 'v1/environments'
122 resp, body = self.get(uri)
123 self.expected_success(200, resp.status)
124
125 return self._parse_resp(body)
126
127 def create_environment(self, name):
128 uri = 'v1/environments'
129 post_body = {'name': name}
130 resp, body = self.post(uri, json.dumps(post_body))
131 self.expected_success(200, resp.status)
132 return self._parse_resp(body)
133
134 def delete_environment(self, environment_id):
135 uri = 'v1/environments/{0}'.format(environment_id)
136 resp, body = self.delete(uri)
137 self.expected_success(200, resp.status)
138
139 def abandon_environment(self, environment_id):
140 uri = 'v1/environments/{0}?abandon=True'.format(environment_id)
141 resp, body = self.delete(uri)
142 self.expected_success(200, resp.status)
143
144 def update_environment(self, environment_id):
145 uri = 'v1/environments/{0}'.format(environment_id)
146 name = utils.generate_name("updated_env")
147 post_body = {"name": name}
148 resp, body = self.put(uri, json.dumps(post_body))
149 self.expected_success(200, resp.status)
150 return self._parse_resp(body)
151
152 def get_environment(self, environment_id):
153 uri = 'v1/environments/{0}'.format(environment_id)
154 resp, body = self.get(uri)
155 self.expected_success(200, resp.status)
156 return self._parse_resp(body)
157
158 def get_environment_model(self, environment_id, path='/', session_id=None):
159 headers = self.get_headers()
160 if session_id:
161 headers.update(
162 {'X-Configuration-Session': session_id}
163 )
164 uri = '/v1/environments/{id}/model/{path}'.format(
165 id=environment_id, path=path)
166 resp, body = self.get(uri, headers=headers)
167 self.expected_success(200, resp.status)
168 return json.loads(body)
169
170 def update_environment_model(self, environment_id, data, session_id):
171 headers = self.get_headers(send_type='env-model-json-patch')
172 headers.update(
173 {'X-Configuration-Session': session_id}
174 )
175 uri = '/v1/environments/{id}/model/'.format(id=environment_id)
176 resp, body = self.patch(uri, json.dumps(data), headers=headers)
177 self.expected_success(200, resp.status)
178 return json.loads(body)
179
180# -----------------------Methods for session manage ---------------------------
181 def create_session(self, environment_id):
182 body = None
183 uri = 'v1/environments/{0}/configure'.format(environment_id)
184 resp, body = self.post(uri, body)
185 self.expected_success(200, resp.status)
186 return self._parse_resp(body)
187
188 def delete_session(self, environment_id, session_id):
189 uri = 'v1/environments/{0}/sessions/{1}'.format(environment_id,
190 session_id)
191 resp, body = self.delete(uri)
192 self.expected_success(200, resp.status)
193 return self._parse_resp(body)
194
195 def get_session(self, environment_id, session_id):
196 uri = 'v1/environments/{0}/sessions/{1}'.format(environment_id,
197 session_id)
198 resp, body = self.get(uri)
199 self.expected_success(200, resp.status)
200 return self._parse_resp(body)
201
202 def deploy_session(self, environment_id, session_id):
203 body = None
204 url = 'v1/environments/{0}/sessions/{1}/deploy'.format(environment_id,
205 session_id)
206 resp, body = self.post(url, body)
207 self.expected_success(200, resp.status)
208 return self._parse_resp(body)
209
210# ----------------------------Deployment methods-------------------------------
211
212 def list_deployments(self, environment_id):
213 uri = 'v1/environments/{0}/deployments'.format(
214 environment_id)
215 body = None
216
217 resp, body = self.get(uri, body)
218 self.expected_success(200, resp.status)
219 return self._parse_resp(body)
220
221 def list_deployment_statuses(self, environment_id, deployment_id):
222 uri = 'v1/environments/{0}/deployments/{1}'.format(
223 environment_id, deployment_id)
224 body = None
225
226 resp, body = self.get(uri, body)
227 self.expected_success(200, resp.status)
228 return self._parse_resp(body)
229
230 def list_all_deployments(self):
231 uri = 'v1/deployments'
232 body = None
233
234 resp, body = self.get(uri, body)
235 self.expected_success(200, resp.status)
236 return self._parse_resp(body)
237
238# -----------------------------Service methods---------------------------------
239 def create_service(self, environment_id, session_id, post_body):
240 headers = self.get_headers()
241 headers.update(
242 {'X-Configuration-Session': session_id}
243 )
244 uri = 'v1/environments/{0}/services'.format(environment_id)
245 resp, body = self.post(uri, json.dumps(post_body), headers)
246 self.expected_success(200, resp.status)
247 return self._parse_resp(body)
248
249 def update_services(self, environment_id, session_id, put_body=None):
250 headers = self.get_headers()
251 headers.update(
252 {'X-Configuration-Session': session_id}
253 )
254 uri = 'v1/environments/{0}/services'.format(environment_id)
255 resp, body = self.put(uri, json.dumps(put_body), headers)
256 self.expected_success(200, resp.status)
257 # TODO(freerunner): Need to replace json.loads() to _parse_resp
258 # method, when fix for https://bugs.launchpad.net/tempest/+bug/1539927
259 # will resolved and new version of tempest-lib released.
260 return json.loads(body)
261
262 def delete_service(self, environment_id, session_id, service_id):
263 headers = self.get_headers()
264 headers.update(
265 {'X-Configuration-Session': session_id}
266 )
267 uri = 'v1/environments/{0}/services/{1}'.format(environment_id,
268 service_id)
269 resp, body = self.delete(uri, headers)
270 self.expected_success(200, resp.status)
271 return self._parse_resp(body)
272
273 def get_services_list(self, environment_id, session_id=None):
274 headers = self.get_headers()
275 if session_id:
276 headers.update(
277 {'X-Configuration-Session': session_id}
278 )
279 uri = 'v1/environments/{0}/services'.format(environment_id)
280 resp, body = self.get(uri, headers)
281 self.expected_success(200, resp.status)
282 # TODO(freerunner): Need to replace json.loads() to _parse_resp
283 # method, when fix for https://bugs.launchpad.net/tempest/+bug/1539927
284 # will resolved and new version of tempest-lib released.
285 return json.loads(body)
286
287 def get_service(self, environment_id, service_id, session_id=None):
288 headers = self.get_headers()
289 if session_id:
290 headers.update(
291 {'X-Configuration-Session': session_id}
292 )
293 uri = 'v1/environments/{0}/services/{1}'.format(environment_id,
294 service_id)
295 resp, body = self.get(uri, headers)
296 self.expected_success(200, resp.status)
297 return self._parse_resp(body)
298
299# -----------------------------Category methods--------------------------------
300 def list_categories(self):
301 uri = 'v1/catalog/categories'
302 resp, body = self.get(uri)
303 self.expected_success(200, resp.status)
304 return self._parse_resp(body)
305
306 def create_category(self, name):
307 body = {'name': name}
308 uri = 'v1/catalog/categories'
309 resp, body = self.post(uri, json.dumps(body))
310 self.expected_success(200, resp.status)
311 return self._parse_resp(body)
312
313 def delete_category(self, category_id):
314 uri = 'v1/catalog/categories/{0}'.format(category_id)
315 resp, body = self.delete(uri)
316 self.expected_success(200, resp.status)
317 return self._parse_resp(body)
318
319 def get_category(self, category_id):
320 uri = 'v1/catalog/categories/{0}'.format(category_id)
321 resp, body = self.get(uri)
322 self.expected_success(200, resp.status)
323 return self._parse_resp(body)
324
325# ----------------------Environment templates methods--------------------------
326 def get_env_templates_list(self):
327 uri = 'v1/templates'
328 resp, body = self.get(uri)
329 self.expected_success(200, resp.status)
330 return self._parse_resp(body)
331
332 def get_public_env_templates_list(self):
333 uri = 'v1/templates?is_public=true'
334 resp, body = self.get(uri)
335 self.expected_success(200, resp.status)
336 return self._parse_resp(body)
337
338 def get_private_env_templates_list(self):
339 uri = 'v1/templates?is_public=false'
340 resp, body = self.get(uri)
341 self.expected_success(200, resp.status)
342 return self._parse_resp(body)
343
344 def create_env_template(self, env_template_name):
345 body = {'name': env_template_name, "is_public": False,
346 "description_text": "description"}
347 uri = 'v1/templates'
348 resp, body = self.post(uri, json.dumps(body))
349 self.expected_success(200, resp.status)
350 return self._parse_resp(body)
351
352 def clone_env_template(self, env_template_id, cloned_env_template_name):
353 body = {'name': cloned_env_template_name}
354 uri = 'v1/templates/{0}/clone'.format(env_template_id)
355 resp, body = self.post(uri, json.dumps(body))
356 self.expected_success(200, resp.status)
357 return self._parse_resp(body)
358
359 def create_public_env_template(self, env_template_name):
360 body = {'name': env_template_name, "is_public": True}
361 uri = 'v1/templates'
362 resp, body = self.post(uri, json.dumps(body))
363 self.expected_success(200, resp.status)
364 return self._parse_resp(body)
365
366 def create_env_template_with_services(self, env_template_name, post_body):
367 body = {
368 'name': env_template_name,
369 'services': [post_body]
370 }
371 uri = 'v1/templates'
372 resp, body = self.post(uri, json.dumps(body))
373 self.expected_success(200, resp.status)
374 return self._parse_resp(body)
375
376 def create_service_in_env_template(self, env_template_id, post_body):
377 uri = 'v1/templates/{0}/services'.format(env_template_id)
378 resp, body = self.post(uri, json.dumps(post_body))
379 self.expected_success(200, resp.status)
380 return self._parse_resp(body)
381
382 def get_services_list_in_env_template(self, env_template_id):
383 uri = 'v1/templates/{0}/services'.format(env_template_id)
384 resp, body = self.get(uri)
385 self.expected_success(200, resp.status)
386 # TODO(freerunner): Need to replace json.loads() to _parse_resp
387 # method, when fix for https://bugs.launchpad.net/tempest/+bug/1539927
388 # will resolved and new version of tempest-lib released.
389 return json.loads(body)
390
391 def get_service_in_env_template(self, env_template_name, service_id):
392 uri = 'v1/templates/{0}/services/{1}'.format(env_template_name,
393 service_id)
394 resp, body = self.get(uri)
395 self.expected_success(200, resp.status)
396 return json.loads(body)
397
398 def update_service_from_env_template(self, env_template_id, service_id,
399 post_body):
400 uri = 'v1/templates/{0}/services/{1}'.format(env_template_id,
401 service_id)
402 resp, body = self.put(uri, json.dumps(post_body))
403 self.expected_success(200, resp.status)
404 return self._parse_resp(body)
405
406 def delete_service_from_env_template(self, env_template_name, service_id):
407 uri = 'v1/templates/{0}/services/{1}'.format(env_template_name,
408 service_id)
409 resp, body = self.delete(uri)
410 self.expected_success(200, resp.status)
411 return self._parse_resp(body)
412
413 def delete_env_template(self, env_template_id):
414 uri = 'v1/templates/{0}'.format(env_template_id)
415 resp, body = self.delete(uri)
416 self.expected_success(200, resp.status)
417 return self._parse_resp(body)
418
419 def get_env_template(self, env_template_id):
420 uri = 'v1/templates/{0}'.format(env_template_id)
421 resp, body = self.get(uri)
422 self.expected_success(200, resp.status)
423 return self._parse_resp(body)
424
425 def create_env_from_template(self, env_template_id, env_name):
426 body = {'name': env_name}
427 uri = 'v1/templates/{0}/create-environment'.format(env_template_id)
428 resp, body = self.post(uri, json.dumps(body))
429 self.expected_success(200, resp.status)
430 return self._parse_resp(body)
431
432# ----------------------------Static action methods----------------------------
433 def call_static_action(self, class_name=None, method_name=None, args=None,
434 package_name=None, class_version="=0"):
435 uri = 'v1/actions'
436 post_body = {
437 'parameters': args or {},
438 'packageName': package_name,
439 'classVersion': class_version
440 }
441 if class_name:
442 post_body['className'] = class_name
443 if method_name:
444 post_body['methodName'] = method_name
445
446 resp, body = self.post(uri, json.dumps(post_body))
447 self.expected_success(200, resp.status)
448 # _parse_resp() cannot be used because body is expected to be string
449 return body
diff --git a/murano_tempest_tests/services/artifacts/__init__.py b/murano_tempest_tests/services/artifacts/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/murano_tempest_tests/services/artifacts/__init__.py
+++ /dev/null
diff --git a/murano_tempest_tests/services/artifacts/artifacts_client.py b/murano_tempest_tests/services/artifacts/artifacts_client.py
deleted file mode 100644
index 789497b..0000000
--- a/murano_tempest_tests/services/artifacts/artifacts_client.py
+++ /dev/null
@@ -1,157 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16import json
17import os
18
19from tempest import config
20from tempest.lib.common import rest_client
21
22from murano_tempest_tests import utils
23
24CONF = config.CONF
25
26
27class ArtifactsClient(rest_client.RestClient):
28 """Tempest REST client for Glance Artifacts"""
29
30 def __init__(self, auth_provider):
31 super(ArtifactsClient, self).__init__(
32 auth_provider,
33 CONF.artifacts.catalog_type,
34 CONF.identity.region,
35 endpoint_type=CONF.artifacts.endpoint_type)
36 self.build_interval = CONF.artifacts.build_interval
37 self.build_timeout = CONF.artifacts.build_timeout
38
39# -----------------------------Artifacts methods-------------------------------
40
41 def list_artifacts(self):
42 uri = 'v0.1/artifacts/murano/v1'
43 resp, body = self.get(uri)
44 self.expected_success(200, resp.status)
45 parsed = self._parse_resp(body)
46 return parsed['artifacts']
47
48 def list_drafts(self):
49 uri = 'v0.1/artifacts/murano/v1/creating'
50 resp, body = self.get(uri)
51 self.expected_success(200, resp.status)
52 return self._parse_resp(body)
53
54 def list_deactivated_drafts(self):
55 uri = 'v0.1/artifacts/murano/v1/deactivated'
56 resp, body = self.get(uri)
57 self.expected_success(200, resp.status)
58 return self._parse_resp(body)
59
60 def create_artifact_draft(self, name, version, **kwargs):
61 uri = 'v0.1/artifacts/murano/v1/drafts'
62 kwargs.update({'name': name, 'version': version})
63 resp, body = self.post(uri, body=json.dumps(kwargs))
64 self.expected_success(201, resp.status)
65 return self._parse_resp(body)
66
67 def publish_artifact(self, artifact_id):
68 uri = 'v0.1/artifacts/murano/v1/{0}/publish'.format(artifact_id)
69 resp, body = self.post(uri, body='')
70 self.expected_success(200, resp.status)
71 return self._parse_resp(body)
72
73 def get_artifact(self, artifact_id):
74 uri = 'v0.1/artifacts/murano/v1/{0}'.format(artifact_id)
75 resp, body = self.get(uri)
76 self.expected_success(200, resp.status)
77 return self._parse_resp(body)
78
79 def update_artifact(self, artifact_id, body):
80 headers = {
81 'Content-Type': 'application/openstack-images-v2.1-json-patch'}
82 uri = 'v0.1/artifacts/murano/v1/{0}'.format(artifact_id)
83 resp, body = self.patch(uri, json.dumps(body), headers=headers)
84 self.expected_success(200, resp.status)
85 return self._parse_resp(body)
86
87 def delete_artifact(self, artifact_id):
88 uri = 'v0.1/artifacts/murano/v1/{0}'.format(artifact_id)
89 resp, body = self.delete(uri)
90 self.expected_success(204, resp.status)
91 return self._parse_resp(body)
92
93 def upload_blob(self, artifact_id, blob_type, data):
94 headers = {'Content-Type': 'application/octet-stream'}
95 uri = 'v0.1/artifacts/murano/v1/{0}/{1}'.format(
96 artifact_id, blob_type)
97 resp, body = self.put(uri, data, headers=headers)
98 self.expected_success(200, resp.status)
99 return self._parse_resp(body)
100
101 def download_blob(self, artifact_id, blob_type):
102 uri = 'v0.1/artifacts/murano/v1/{0}/{1}/download'.format(
103 artifact_id, blob_type)
104 resp, body = self.get(uri)
105 self.expected_success(200, resp.status)
106 return self._parse_resp(body)
107
108# -----------------------------Packages methods-------------------------------
109
110 def get_list_packages(self):
111 return self.list_artifacts()
112
113 def delete_package(self, package_id):
114 return self.delete_artifact(package_id)
115
116 def upload_package(self, package_name, package_path, top_dir, body):
117 files = {package_name: open(os.path.join(top_dir, package_path), 'rb')}
118 is_public = body.pop('is_public', None)
119 if is_public is not None:
120 body['visibility'] = 'public' if is_public else 'private'
121 fqn = list(files.keys())[0]
122 package = utils.Package.from_file(files[fqn])
123 manifest = package.manifest
124 package_draft = {
125 'name': manifest.get('FullName', fqn),
126 'version': manifest.get('Version', '0.0.0'),
127 'description': manifest.get('Description'),
128 'display_name': manifest.get('Name', fqn),
129 'type': manifest.get('Type', 'Application'),
130 'author': manifest.get('Author'),
131 'tags': manifest.get('Tags', []),
132 'class_definitions': package.classes.keys()
133 }
134 for k, v in body.items():
135 package_draft[k] = v
136
137 inherits = utils.get_local_inheritance(package.classes)
138
139 # TODO(kzaitsev): add local and global inheritance information tests
140 package_draft['inherits'] = inherits
141
142 keywords = package_draft['tags']
143 package_draft['keywords'] = keywords
144
145 draft = self.create_artifact_draft(**package_draft)
146 self.upload_blob(draft['id'], 'archive', package.file())
147
148 # TODO(kzaitsev): add logo upload code, currently it's failing for me
149 # with io.UnsupportedOperation: fileno
150
151 # if package.logo is not None:
152 # self.upload_blob(draft['id'], 'logo', package.logo)
153 # if package.ui is not None:
154 # self.client.artifacts.upload_blob(draft['id'], 'ui_definition',
155 # package.ui)
156 self.publish_artifact(draft['id'])
157 return draft
diff --git a/murano_tempest_tests/services/service_broker/__init__.py b/murano_tempest_tests/services/service_broker/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/murano_tempest_tests/services/service_broker/__init__.py
+++ /dev/null
diff --git a/murano_tempest_tests/services/service_broker/service_broker_client.py b/murano_tempest_tests/services/service_broker/service_broker_client.py
deleted file mode 100644
index 0413237..0000000
--- a/murano_tempest_tests/services/service_broker/service_broker_client.py
+++ /dev/null
@@ -1,108 +0,0 @@
1# Copyright (c) 2015 Mirantis, Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16import base64
17import json
18
19from tempest import config
20from tempest.lib.common import rest_client
21
22from murano_tempest_tests import utils
23
24CONF = config.CONF
25
26
27class ServiceBrokerClient(rest_client.RestClient):
28 """Tempest REST client for Murano Service Broker"""
29
30 def __init__(self, auth_provider):
31 super(ServiceBrokerClient, self).__init__(
32 auth_provider,
33 CONF.service_broker.catalog_type,
34 CONF.identity.region,
35 endpoint_type=CONF.service_broker.endpoint_type)
36 self.build_interval = CONF.service_broker.build_interval
37 self.build_timeout = CONF.service_broker.build_timeout
38 self.headers = self._generate_headers(auth_provider)
39
40 @classmethod
41 def _generate_headers(cls, auth_provider):
42 """Generate base64-encoded auth string for murano-cfapi
43
44 :param auth_provider:
45 :return: headers
46 """
47 uname = auth_provider.credentials.username
48 pwd = auth_provider.credentials.password
49
50 encoded_auth = base64.b64encode('{0}:{1}'.format(uname, pwd))
51 headers = {"Authorization": "Basic " + encoded_auth,
52 'content-type': 'application/json'}
53 return headers
54
55 def get_applications_list(self):
56 """Get list of all available applications"""
57 uri = "/v2/catalog"
58 resp, body = self.get(uri, headers=self.headers)
59 self.expected_success(200, resp.status)
60 return self._parse_resp(body)
61
62 def provision(self, instance_id, service_id, plan_id, space_id, post_json):
63 """Create new service resources for developer"""
64 uri = '/v2/service_instances/{0}?accepts_incomplete=true'.\
65 format(instance_id)
66 body = {
67 'service_id': service_id,
68 'plan_id': plan_id,
69 'organization_guid': self.tenant_id,
70 'space_guid': space_id,
71 'parameters': post_json
72 }
73 body = json.dumps(body)
74 resp, body = self.put(uri, body, headers=self.headers)
75 self.expected_success([200, 202], resp.status)
76 return body
77
78 def deprovision(self, instance_id):
79 uri = '/v2/service_instances/{0}?accepts_incomplete=true'.\
80 format(instance_id)
81 resp, body = self.delete(uri, headers=self.headers)
82 self.expected_success(202, resp.status)
83 return body
84
85 def get_last_status(self, instance_id):
86 uri = '/v2/service_instances/{0}/last_operation'.format(instance_id)
87 resp, body = self.get(uri, headers=self.headers)
88 self.expected_success([200, 202], resp.status)
89 return self._parse_resp(body)
90
91 def get_application(self, name, app_list):
92 for app in app_list:
93 if app['name'] == name:
94 return app
95
96 def create_binding(self, instance_id):
97 binding_id = utils.generate_uuid()
98 uri = "/v2/service_instances/{0}/service_bindings/{1}".format(
99 instance_id, binding_id)
100 post_body = {
101 "plan_id": utils.generate_uuid(),
102 "service_id": utils.generate_uuid(),
103 "app_guid": utils.generate_uuid()
104 }
105 body = json.dumps(post_body)
106 resp, body = self.put(uri, body, headers=self.headers)
107 self.expected_success([200, 201], resp.status)
108 return self._parse_resp(body)
diff --git a/murano_tempest_tests/tests/__init__.py b/murano_tempest_tests/tests/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/murano_tempest_tests/tests/__init__.py
+++ /dev/null
diff --git a/murano_tempest_tests/tests/api/__init__.py b/murano_tempest_tests/tests/api/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/murano_tempest_tests/tests/api/__init__.py
+++ /dev/null
diff --git a/murano_tempest_tests/tests/api/application_catalog/__init__.py b/murano_tempest_tests/tests/api/application_catalog/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/__init__.py
+++ /dev/null
diff --git a/murano_tempest_tests/tests/api/application_catalog/artifacts/__init__.py b/murano_tempest_tests/tests/api/application_catalog/artifacts/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/artifacts/__init__.py
+++ /dev/null
diff --git a/murano_tempest_tests/tests/api/application_catalog/artifacts/base.py b/murano_tempest_tests/tests/api/application_catalog/artifacts/base.py
deleted file mode 100644
index e7d993c..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/artifacts/base.py
+++ /dev/null
@@ -1,97 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.common import credentials_factory as common_creds
17from tempest import config
18from tempest import test
19
20from murano_tempest_tests import clients
21from murano_tempest_tests import utils
22
23CONF = config.CONF
24
25
26class BaseArtifactsTest(test.BaseTestCase):
27 """Base test class for Murano Glare tests."""
28
29 @classmethod
30 def skip_checks(cls):
31 super(BaseArtifactsTest, cls).skip_checks()
32 if not CONF.service_available.murano:
33 skip_msg = "Murano is disabled"
34 raise cls.skipException(skip_msg)
35
36 @classmethod
37 def setup_clients(cls):
38 super(BaseArtifactsTest, cls).setup_clients()
39 if not hasattr(cls, "os_primary"):
40 creds = cls.get_configured_isolated_creds(type_of_creds='primary')
41 cls.os_primary = clients.Manager(credentials=creds)
42 cls.artifacts_client = cls.os_primary.artifacts_client
43 cls.application_catalog_client = \
44 cls.os_primary.application_catalog_client
45
46 @classmethod
47 def get_client_with_isolated_creds(cls, type_of_creds="admin"):
48 creds = cls.get_configured_isolated_creds(type_of_creds=type_of_creds)
49
50 os = clients.Manager(credentials=creds)
51 client = os.artifacts_client
52
53 return client
54
55 @classmethod
56 def get_configured_isolated_creds(cls, type_of_creds='admin'):
57 identity_version = CONF.identity.auth_version
58 if identity_version == 'v3':
59 cls.admin_role = CONF.identity.admin_role
60 else:
61 cls.admin_role = 'admin'
62 cls.credentials = common_creds.get_credentials_provider(
63 name=cls.__name__,
64 force_tenant_isolation=CONF.auth.use_dynamic_credentials,
65 identity_version=CONF.identity.auth_version)
66 if type_of_creds == 'primary':
67 creds = cls.credentials.get_primary_creds()
68 elif type_of_creds == 'admin':
69 creds = cls.credentials.get_admin_creds()
70 elif type_of_creds == 'alt':
71 creds = cls.credentials.get_alt_creds()
72 else:
73 creds = cls.credentials.get_credentials(type_of_creds)
74 cls.credentials.type_of_creds = type_of_creds
75
76 return creds.credentials
77
78 @classmethod
79 def upload_package(cls, application_name, version=None, require=None):
80 abs_archive_path, dir_with_archive, archive_name = \
81 utils.prepare_package(application_name, version=version,
82 add_class_name=True, require=require)
83 package = cls.artifacts_client.upload_package(
84 application_name, archive_name, dir_with_archive,
85 {"categories": [], "tags": [], 'is_public': False})
86 return package, abs_archive_path
87
88 @staticmethod
89 def create_obj_model(package):
90 return {
91 "name": package['display_name'],
92 "?": {
93 "type": package['name'],
94 "id": utils.generate_uuid(),
95 "classVersion": package['version']
96 }
97 }
diff --git a/murano_tempest_tests/tests/api/application_catalog/artifacts/test_repository.py b/murano_tempest_tests/tests/api/application_catalog/artifacts/test_repository.py
deleted file mode 100644
index 1b9a842..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/artifacts/test_repository.py
+++ /dev/null
@@ -1,56 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import os
16
17from tempest import config
18from tempest.lib import decorators
19
20from murano_tempest_tests.tests.api.application_catalog.artifacts import base
21from murano_tempest_tests import utils
22
23CONF = config.CONF
24
25
26class TestRepositorySanity(base.BaseArtifactsTest):
27
28 @classmethod
29 def resource_setup(cls):
30 if not CONF.application_catalog.glare_backend:
31 msg = ("Murano is not using GLARE backend. "
32 "Skipping GLARE tests.")
33 raise cls.skipException(msg)
34 super(TestRepositorySanity, cls).resource_setup()
35
36 @decorators.attr(type='smoke')
37 @decorators.idempotent_id('2818aaa0-6613-4bd9-8abe-02713121357a')
38 def test_get_list_packages(self):
39 package_list = self.artifacts_client.get_list_packages()
40 self.assertIsInstance(package_list, list)
41
42 @decorators.attr(type='smoke')
43 @decorators.idempotent_id('bc717c98-5f6b-42a6-9131-43a711cfe848')
44 def test_upload_and_delete_package(self):
45 application_name = utils.generate_name('package_test_upload')
46 abs_archive_path, dir_with_archive, archive_name = \
47 utils.prepare_package(application_name)
48 self.addCleanup(os.remove, abs_archive_path)
49 package = self.artifacts_client.upload_package(
50 application_name, archive_name, dir_with_archive,
51 {"categories": [], "tags": [], 'is_public': False})
52 package_list = self.artifacts_client.get_list_packages()
53 self.assertIn(package['id'], {pkg['id'] for pkg in package_list})
54 self.artifacts_client.delete_package(package['id'])
55 package_list = self.artifacts_client.get_list_packages()
56 self.assertNotIn(package['id'], {pkg['id'] for pkg in package_list})
diff --git a/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning.py b/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning.py
deleted file mode 100644
index 61f7916..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning.py
+++ /dev/null
@@ -1,166 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import os
16
17from tempest import config
18from tempest.lib import decorators
19
20from murano_tempest_tests.tests.api.application_catalog.artifacts import base
21from murano_tempest_tests import utils
22
23CONF = config.CONF
24
25
26class TestVersioning(base.BaseArtifactsTest):
27
28 @classmethod
29 def resource_setup(cls):
30 if not CONF.application_catalog.glare_backend:
31 msg = ("Murano is not using GLARE backend. "
32 "Skipping GLARE tests.")
33 raise cls.skipException(msg)
34 super(TestVersioning, cls).resource_setup()
35
36 application_name = utils.generate_name('package_test')
37 # create first package
38 version1 = '1.0.0'
39 package1, _ = cls.upload_package(application_name,
40 version=version1)
41
42 # create second package
43 version2 = '2.0.0'
44 package2, path1 = cls.upload_package(application_name,
45 version=version2)
46
47 # create package with require >=2.0.0 for 2.0.0 package
48 expected_version = '>=2.0.0'
49 main_app_name = utils.generate_name('main_package_test')
50 require = [(package2['name'], expected_version)]
51 package3, path2 = cls.upload_package(main_app_name, require=require)
52
53 cls.packages = {
54 '1.0.0': package1,
55 '2.0.0': package2,
56 'require_for_2.0.0': package3,
57 }
58 cls.abs_archive_paths = [path1, path2]
59
60 @classmethod
61 def resource_cleanup(cls):
62 for pkg in cls.packages.values():
63 cls.artifacts_client.delete_package(pkg['id'])
64 map(os.remove, cls.abs_archive_paths)
65 super(TestVersioning, cls).resource_cleanup()
66
67 @decorators.attr(type='smoke')
68 @decorators.idempotent_id('03ee155c-d65f-4ea7-a00a-bdbc7105fc8b')
69 def test_availability_of_packages_with_different_versions(self):
70 """Test availability of packages with different versions.
71
72 1) Check two packages to have the same names.
73 2) Check two packages to have different ids.
74 3) Check two packages to be in repository.
75 """
76 self.assertEqual(self.packages['1.0.0']['name'],
77 self.packages['2.0.0']['name'])
78 self.assertNotEqual(self.packages['1.0.0']['id'],
79 self.packages['2.0.0']['id'])
80
81 # check packages availability
82 artifact_packages = {pkg['id'] for pkg in
83 self.artifacts_client.get_list_packages()}
84
85 self.assertIn(self.packages['1.0.0']['id'], artifact_packages)
86 self.assertIn(self.packages['2.0.0']['id'], artifact_packages)
87
88 @decorators.attr(type='smoke')
89 @decorators.idempotent_id('15c3a52d-cffe-4d03-82c2-31c9be8423d6')
90 def test_deploy_packages_with_different_versions(self):
91 """Test deployment of packages with different versions.
92
93 1) Create environment.
94 2) Add package with version 1.0.0 to the environment.
95 3) Add package with version 2.0.0 to the environment.
96 4) Deploy environment.
97 5) Check if deployment status ok.
98 """
99
100 # create environment
101 environment_name = utils.generate_name('create_environment')
102 environment = self.application_catalog_client.create_environment(
103 environment_name)
104 self.addCleanup(self.application_catalog_client.delete_environment,
105 environment['id'])
106
107 # create session
108 session = self.application_catalog_client.create_session(
109 environment['id'])
110
111 # add first application
112 object_model = self.create_obj_model(self.packages['1.0.0'])
113
114 self.application_catalog_client.create_service(
115 environment['id'], session['id'], object_model)
116
117 # add second application
118 object_model = self.create_obj_model(self.packages['2.0.0'])
119
120 self.application_catalog_client.create_service(
121 environment['id'], session['id'], object_model)
122
123 self.application_catalog_client.deploy_session(
124 environment['id'], session['id'])
125
126 deploy_result = utils.wait_for_environment_deploy(
127 self.application_catalog_client, environment['id'])['status']
128
129 self.assertEqual(deploy_result, 'ready')
130
131 @decorators.attr(type='smoke')
132 @decorators.idempotent_id('2c472476-f9cd-424b-91ee-cbc770602bf3')
133 def test_deploy_package_with_required_package_version(self):
134 """Test deployment of package which requires package with present version.
135
136 1) Create environment.
137 2) Add to the environment package which requires version 2.0.0 of the
138 package, which is present with versions 1.0.0 and 2.0.0 in repository.
139 3) Deploy environment.
140 4) Check if deployment status ok.
141 """
142
143 # create environment
144 environment_name = utils.generate_name('create_environment')
145 environment = self.application_catalog_client.create_environment(
146 environment_name)
147 self.addCleanup(self.application_catalog_client.delete_environment,
148 environment['id'])
149
150 # create session
151 session = self.application_catalog_client.create_session(
152 environment['id'])
153
154 object_model = self.create_obj_model(
155 self.packages['require_for_2.0.0'])
156
157 self.application_catalog_client.create_service(
158 environment['id'], session['id'], object_model)
159
160 self.application_catalog_client.deploy_session(
161 environment['id'], session['id'])
162
163 deploy_result = utils.wait_for_environment_deploy(
164 self.application_catalog_client, environment['id'])['status']
165
166 self.assertEqual(deploy_result, 'ready')
diff --git a/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning_negative.py b/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning_negative.py
deleted file mode 100644
index 2279b1e..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning_negative.py
+++ /dev/null
@@ -1,96 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import os
16
17from tempest import config
18from tempest.lib import decorators
19
20from murano_tempest_tests.tests.api.application_catalog.artifacts import base
21from murano_tempest_tests import utils
22
23CONF = config.CONF
24
25
26class TestVersioningNegative(base.BaseArtifactsTest):
27
28 @classmethod
29 def resource_setup(cls):
30 if not CONF.application_catalog.glare_backend:
31 msg = ("Murano is not using GLARE backend. "
32 "Skipping GLARE tests.")
33 raise cls.skipException(msg)
34 super(TestVersioningNegative, cls).resource_setup()
35
36 # create package with version 1.0.0
37 application_name = utils.generate_name('package_test')
38 provided_version = '1.0.0'
39 package1, path1 = cls.upload_package(
40 application_name, version=provided_version)
41
42 # main application
43 expected_version = '2.0.0'
44 main_app_name = utils.generate_name('main_package_test')
45 require = [(package1['name'], expected_version)]
46 package2, path2 = cls.upload_package(main_app_name, require=require)
47
48 cls.packages = {
49 '1.0.0': package1,
50 'require_for_1.0.0': package2
51 }
52 cls.abs_archive_paths = [path1, path2]
53
54 @classmethod
55 def resource_cleanup(cls):
56 for pkg in cls.packages.values():
57 cls.artifacts_client.delete_package(pkg['id'])
58 map(os.remove, cls.abs_archive_paths)
59 super(TestVersioningNegative, cls).resource_cleanup()
60
61 @decorators.attr(type=['negative', 'smoke'])
62 @decorators.idempotent_id('c72fcd24-4694-4479-b550-bdd8cf0bd348')
63 def test_deploy_package_with_no_required_package_version(self):
64 """Test deployment of package which requires package with absent version.
65
66 1) Create environment.
67 2) Add to the environment package which requires version 2.0.0 of the
68 package, which is present with version 1.0.0 only in repository.
69 3) Deploy environment.
70 4) Check if deployment status failure.
71 """
72
73 # create environment
74 environment_name = utils.generate_name('create_environment')
75 environment = self.application_catalog_client.create_environment(
76 environment_name)
77 self.addCleanup(self.application_catalog_client.delete_environment,
78 environment['id'])
79
80 # create session
81 session = self.application_catalog_client.create_session(
82 environment['id'])
83
84 object_model = self.create_obj_model(
85 self.packages['require_for_1.0.0'])
86
87 self.application_catalog_client.create_service(
88 environment['id'], session['id'], object_model)
89
90 self.application_catalog_client.deploy_session(
91 environment['id'], session['id'])
92
93 deploy_result = utils.wait_for_environment_deploy(
94 self.application_catalog_client, environment['id'])['status']
95
96 self.assertEqual(deploy_result, 'deploy failure')
diff --git a/murano_tempest_tests/tests/api/application_catalog/base.py b/murano_tempest_tests/tests/api/application_catalog/base.py
deleted file mode 100644
index 6dce950..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/base.py
+++ /dev/null
@@ -1,110 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.common import credentials_factory as common_creds
17from tempest import config
18from tempest import test
19
20from murano_tempest_tests import clients
21from murano_tempest_tests import utils
22
23CONF = config.CONF
24
25
26class BaseApplicationCatalogTest(test.BaseTestCase):
27 """Base test class for Murano Service Broker API tests."""
28
29 @classmethod
30 def skip_checks(cls):
31 super(BaseApplicationCatalogTest, cls).skip_checks()
32 if not CONF.service_available.murano:
33 skip_msg = "Murano is disabled"
34 raise cls.skipException(skip_msg)
35
36 @classmethod
37 def setup_clients(cls):
38 super(BaseApplicationCatalogTest, cls).setup_clients()
39 if not hasattr(cls, "os_primary"):
40 creds = cls.get_configured_isolated_creds(type_of_creds='primary')
41 cls.os_primary = clients.Manager(credentials=creds)
42 cls.application_catalog_client = \
43 cls.os_primary.application_catalog_client
44 cls.artifacts_client = cls.os_primary.artifacts_client
45
46 @classmethod
47 def get_client_with_isolated_creds(cls, type_of_creds="admin"):
48 creds = cls.get_configured_isolated_creds(type_of_creds=type_of_creds)
49
50 os = clients.Manager(credentials=creds)
51 client = os.application_catalog_client
52
53 return client
54
55 @classmethod
56 def get_configured_isolated_creds(cls, type_of_creds='admin'):
57 identity_version = CONF.identity.auth_version
58 if identity_version == 'v3':
59 cls.admin_role = CONF.identity.admin_role
60 else:
61 cls.admin_role = 'admin'
62 cls.credentials = common_creds.get_credentials_provider(
63 name=cls.__name__,
64 force_tenant_isolation=CONF.auth.use_dynamic_credentials,
65 identity_version=CONF.identity.auth_version)
66 if type_of_creds == 'primary':
67 creds = cls.credentials.get_primary_creds()
68 elif type_of_creds == 'admin':
69 creds = cls.credentials.get_admin_creds()
70 elif type_of_creds == 'alt':
71 creds = cls.credentials.get_alt_creds()
72 else:
73 creds = cls.credentials.get_credentials(type_of_creds)
74 cls.credentials.type_of_creds = type_of_creds
75
76 return creds.credentials
77
78 @staticmethod
79 def _get_demo_app():
80 return {
81 "instance": {
82 "assignFloatingIp": "true",
83 "keyname": "mykeyname",
84 "image": "cloud-fedora-v3",
85 "flavor": "m1.medium",
86 "?": {
87 "type": "io.murano.resources.LinuxMuranoInstance",
88 "id": "ef984a74-29a4-45c0-b1dc-2ab9f075732e"
89 }
90 },
91 "name": "orion",
92 "port": "8080",
93 "?": {
94 "type": "io.murano.apps.apache.Tomcat",
95 "id": utils.generate_uuid()
96 }
97 }
98
99
100class BaseApplicationCatalogIsolatedAdminTest(BaseApplicationCatalogTest):
101
102 @classmethod
103 def setup_clients(cls):
104 super(BaseApplicationCatalogIsolatedAdminTest, cls).setup_clients()
105 if not hasattr(cls, "os_admin"):
106 creds = cls.get_configured_isolated_creds(type_of_creds='admin')
107 cls.os_admin = clients.Manager(credentials=creds)
108 cls.application_catalog_client = \
109 cls.os_admin.application_catalog_client
110 cls.artifacts_client = cls.os_admin.artifacts_client
diff --git a/murano_tempest_tests/tests/api/application_catalog/test_categories.py b/murano_tempest_tests/tests/api/application_catalog/test_categories.py
deleted file mode 100644
index cbd486a..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/test_categories.py
+++ /dev/null
@@ -1,113 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import os
16
17from tempest.lib import decorators
18
19from murano_tempest_tests.tests.api.application_catalog import base
20from murano_tempest_tests import utils
21
22
23class TestCategories(base.BaseApplicationCatalogIsolatedAdminTest):
24
25 @classmethod
26 def resource_setup(cls):
27 super(TestCategories, cls).resource_setup()
28 application_name = utils.generate_name(cls.__name__)
29 cls.abs_archive_path, dir_with_archive, archive_name = \
30 utils.prepare_package(application_name)
31 cls.package = cls.application_catalog_client.upload_package(
32 application_name, archive_name, dir_with_archive,
33 {"categories": [], "tags": [], 'is_public': False})
34 name = utils.generate_name(cls.__name__)
35 cls.category = cls.application_catalog_client.create_category(name)
36
37 @classmethod
38 def resource_cleanup(cls):
39 os.remove(cls.abs_archive_path)
40 cls.application_catalog_client.delete_package(cls.package['id'])
41 cls.application_catalog_client.delete_category(cls.category['id'])
42 super(TestCategories, cls).resource_cleanup()
43
44 @decorators.attr(type='smoke')
45 @decorators.idempotent_id('4785781d-4bea-4559-939e-1c2fdf0dbec3')
46 def test_list_categories(self):
47 categories_list = self.application_catalog_client.list_categories()
48 self.assertIsInstance(categories_list, list)
49
50 @decorators.attr(type='smoke')
51 @decorators.idempotent_id('c02841bc-3305-4e88-a733-696fb8690552')
52 def test_create_and_delete_category(self):
53 name = utils.generate_name('create_and_delete_category')
54 categories_list = self.application_catalog_client.list_categories()
55 category_names = [c['name'] for c in categories_list]
56 self.assertNotIn(name, category_names)
57
58 category = self.application_catalog_client.create_category(name)
59 self.assertEqual(name, category['name'])
60
61 categories_list = self.application_catalog_client.list_categories()
62 category_names = [c['name'] for c in categories_list]
63 self.assertIn(name, category_names)
64
65 self.application_catalog_client.delete_category(category['id'])
66 categories_list = self.application_catalog_client.list_categories()
67 category_names = [c['name'] for c in categories_list]
68 self.assertNotIn(name, category_names)
69
70 @decorators.idempotent_id('c7931b7f-e811-4555-8ecc-84bea7885d96')
71 def test_get_category(self):
72 category = self.application_catalog_client.get_category(
73 self.category['id'])
74 self.assertEqual(self.category['id'], category['id'])
75 self.assertEqual(self.category['name'], category['name'])
76
77 @decorators.idempotent_id('9b92705a-4203-4f02-9d6b-abc797c0eaac')
78 def test_add_package_to_new_category_and_remove_it_from_category(self):
79 category = self.application_catalog_client.get_category(
80 self.category['id'])
81 self.assertEqual(0, category['package_count'])
82
83 post_body = [
84 {
85 "op": "add",
86 "path": "/categories",
87 "value": [category['name']]
88 }
89 ]
90
91 package = self.application_catalog_client.update_package(
92 self.package['id'], post_body)
93 self.assertIn(self.category['name'], package['categories'])
94 category = self.application_catalog_client.get_category(
95 self.category['id'])
96 self.assertEqual(1, category['package_count'])
97 self.assertEqual(1, len(category['packages']))
98
99 post_body = [
100 {
101 "op": "remove",
102 "path": "/categories",
103 "value": [category['name']]
104 }
105 ]
106
107 package = self.application_catalog_client.update_package(
108 self.package['id'], post_body)
109 self.assertNotIn(self.category['name'], package['categories'])
110 category = self.application_catalog_client.get_category(
111 self.category['id'])
112 self.assertEqual(0, category['package_count'])
113 self.assertEqual(0, len(category['packages']))
diff --git a/murano_tempest_tests/tests/api/application_catalog/test_categories_negative.py b/murano_tempest_tests/tests/api/application_catalog/test_categories_negative.py
deleted file mode 100644
index 4f5ecec..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/test_categories_negative.py
+++ /dev/null
@@ -1,72 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import os
16
17from tempest.lib import decorators
18from tempest.lib import exceptions
19
20from murano_tempest_tests.tests.api.application_catalog import base
21from murano_tempest_tests import utils
22
23
24class TestCategoriesNegative(base.BaseApplicationCatalogIsolatedAdminTest):
25
26 @classmethod
27 def resource_setup(cls):
28 super(TestCategoriesNegative, cls).resource_setup()
29 application_name = utils.generate_name(cls.__name__)
30 name = utils.generate_name(cls.__name__)
31 cls.category = cls.application_catalog_client.create_category(name)
32 cls.abs_archive_path, dir_with_archive, archive_name = \
33 utils.prepare_package(application_name)
34 cls.package = cls.application_catalog_client.upload_package(
35 application_name, archive_name, dir_with_archive,
36 {"categories": [cls.category['name']],
37 "tags": [], 'is_public': False})
38
39 @classmethod
40 def resource_cleanup(cls):
41 os.remove(cls.abs_archive_path)
42 cls.application_catalog_client.delete_package(cls.package['id'])
43 cls.application_catalog_client.delete_category(cls.category['id'])
44 super(TestCategoriesNegative, cls).resource_cleanup()
45
46 @decorators.attr(type='negative')
47 @decorators.idempotent_id('20fe075f-7d07-462e-bfbc-3032b5367207')
48 def test_delete_category_by_incorrect_id(self):
49 self.assertRaises(exceptions.NotFound,
50 self.application_catalog_client.delete_category,
51 utils.generate_uuid())
52
53 @decorators.attr(type='negative')
54 @decorators.idempotent_id('e655365b-ec8b-49da-8745-5c80b1f5e65b')
55 def test_get_category_by_incorrect_id(self):
56 self.assertRaises(exceptions.NotFound,
57 self.application_catalog_client.get_category,
58 utils.generate_uuid())
59
60 @decorators.attr(type='negative')
61 @decorators.idempotent_id('c4948d0f-3530-419c-8017-1ee8bbc29dee')
62 def test_create_category_with_same_name(self):
63 self.assertRaises(exceptions.Conflict,
64 self.application_catalog_client.create_category,
65 self.category['name'])
66
67 @decorators.attr(type='negative')
68 @decorators.idempotent_id('2bdce780-96dc-46d6-a28e-cdcf768359ae')
69 def test_delete_category_with_package(self):
70 self.assertRaises(exceptions.Forbidden,
71 self.application_catalog_client.delete_category,
72 self.category['id'])
diff --git a/murano_tempest_tests/tests/api/application_catalog/test_deployments.py b/murano_tempest_tests/tests/api/application_catalog/test_deployments.py
deleted file mode 100644
index 4103e8e..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/test_deployments.py
+++ /dev/null
@@ -1,86 +0,0 @@
1# Copyright (c) 2017 AT&T Corporation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15from tempest.lib import decorators
16
17from murano_tempest_tests.tests.api.application_catalog import base
18from murano_tempest_tests import utils
19
20
21class TestDeployments(base.BaseApplicationCatalogTest):
22
23 def _create_and_deploy_env_session(self):
24 name = utils.generate_name('_create_and_deploy_env_session')
25 environment = self.application_catalog_client.create_environment(
26 name)
27 self.addCleanup(self.application_catalog_client.delete_environment,
28 environment['id'])
29 session = self.application_catalog_client.create_session(
30 environment['id'])
31 self.addCleanup(self.application_catalog_client.delete_session,
32 environment['id'], session['id'])
33 self.application_catalog_client.deploy_session(environment['id'],
34 session['id'])
35 utils.wait_for_environment_deploy(self.application_catalog_client,
36 environment['id'])
37 return environment
38
39 @decorators.idempotent_id('ea4f6f21-bd97-4b58-af93-6fe5417543f9')
40 def test_list_all_deployments(self):
41 # Given two environments with deployments
42 environment1 = self._create_and_deploy_env_session()
43 environment2 = self._create_and_deploy_env_session()
44
45 # When list_all_deployments is called
46 deployments = self.application_catalog_client.list_all_deployments()
47
48 # Then both environment's deployments are returned
49 self.assertEqual(2, len(deployments))
50 environment_ids = [d['environment_id'] for d in deployments]
51 self.assertIn(environment1['id'], environment_ids)
52 self.assertIn(environment2['id'], environment_ids)
53
54 @decorators.idempotent_id('d76706f6-9281-4fdc-9758-57da825311b1')
55 def test_list_deployments(self):
56 # Given two environments with deployments
57 environment1 = self._create_and_deploy_env_session()
58 self._create_and_deploy_env_session()
59
60 # When list_deployments is called for first environment
61 deployments = self.application_catalog_client.list_deployments(
62 environment1['id'])
63
64 # Then only the first environment's deployment is returned
65 self.assertEqual(1, len(deployments))
66 first_deployment = deployments[0]
67 self.assertEqual(environment1['id'],
68 first_deployment['environment_id'])
69
70 @decorators.idempotent_id('d6fbba34-92a9-49b3-9c49-e4b7a65eb6e8')
71 def test_list_deployment_statuses(self):
72 # Given an environment with a deployment
73 environment = self._create_and_deploy_env_session()
74 deployment = self.application_catalog_client.list_deployments(
75 environment['id'])[0]
76
77 # When list_deployment_statuses is called
78 statuses = self.application_catalog_client.list_deployment_statuses(
79 environment['id'], deployment['id'])
80
81 # Then the correct statuses for the deployment are returned
82 status_deployment_ids = set([s['task_id'] for s in statuses])
83 self.assertEqual([deployment['id']], list(status_deployment_ids))
84 status_texts = [s['text'] for s in statuses]
85 self.assertEqual(['Action deploy is scheduled', 'Deployment finished'],
86 sorted(status_texts))
diff --git a/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py b/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py
deleted file mode 100644
index 436747a..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py
+++ /dev/null
@@ -1,258 +0,0 @@
1# Copyright (c) 2015 Telefonica I+D.
2# Copyright (c) 2016 Mirantis, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.lib import decorators
17
18from murano_tempest_tests.tests.api.application_catalog import base
19from murano_tempest_tests import utils
20
21
22class TestEnvironmentTemplatesSanity(base.BaseApplicationCatalogTest):
23
24 @decorators.idempotent_id('c13f9799-ed80-463f-8275-6bba62933226')
25 def test_list_empty_env_templates(self):
26 templates_list = self.application_catalog_client.\
27 get_env_templates_list()
28 self.assertIsInstance(templates_list, list)
29
30 @decorators.attr(type='smoke')
31 @decorators.idempotent_id('15363b15-c350-40b9-a96b-de8d7a56a185')
32 def test_create_and_delete_env_template(self):
33 name = utils.generate_name('create_and_delete_env_template')
34 env_template = self.application_catalog_client.\
35 create_env_template(name)
36 self.assertFalse(env_template['is_public'])
37 self.assertEqual(name, env_template['name'])
38 self.assertEqual("description", env_template['description_text'])
39 env_templates_list = self.application_catalog_client.\
40 get_env_templates_list()
41 # Deleting dates from dictionaries to skip it in assert
42 env_template.pop('updated', None)
43 env_template.pop('created', None)
44 map(lambda x: x.pop('updated', None), env_templates_list)
45 map(lambda x: x.pop('created', None), env_templates_list)
46 self.assertIn(env_template, env_templates_list)
47 self.application_catalog_client.\
48 delete_env_template(env_template['id'])
49 env_templates_list = self.application_catalog_client.\
50 get_env_templates_list()
51 self.assertNotIn(env_template, env_templates_list)
52
53
54class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
55
56 @classmethod
57 def resource_setup(cls):
58 super(TestEnvironmentTemplates, cls).resource_setup()
59 name = utils.generate_name(cls.__name__)
60 cls.env_template = cls.application_catalog_client.\
61 create_public_env_template(name)
62 cls.alt_client = cls.get_client_with_isolated_creds('alt')
63
64 @classmethod
65 def resource_cleanup(cls):
66 cls.application_catalog_client.\
67 delete_env_template(cls.env_template['id'])
68 super(TestEnvironmentTemplates, cls).resource_cleanup()
69
70 @decorators.idempotent_id('3821a826-2d14-4287-b56b-4a022bca9044')
71 def test_get_env_template(self):
72 env_template = self.application_catalog_client.\
73 get_env_template(self.env_template['id'])
74 self.assertEqual(self.env_template['name'], env_template['name'])
75
76 @decorators.idempotent_id('c7f77fa4-cdc3-45b7-a013-668668da0c8e')
77 def test_create_env_template_with_a_service(self):
78 name = utils.generate_name('create_env_template_with_service')
79 post_body = self._get_demo_app()
80 env_template = self.application_catalog_client.\
81 create_env_template_with_services(name, post_body)
82 self.addCleanup(self.application_catalog_client.delete_env_template,
83 env_template['id'])
84 list_services = self.application_catalog_client.\
85 get_services_list_in_env_template(env_template['id'])
86 self.assertIsInstance(list_services, list)
87 self.assertIn(post_body, list_services)
88
89 @decorators.attr(type='smoke')
90 @decorators.idempotent_id('be1be6c8-b882-4b17-9221-4b88c71d8d31')
91 def test_add_and_remove_service_in_env_templates(self):
92 env_template_services = self.application_catalog_client.\
93 get_services_list_in_env_template(self.env_template['id'])
94 self.assertIsInstance(env_template_services, list)
95 post_body = self._get_demo_app()
96 service = self.application_catalog_client.\
97 create_service_in_env_template(self.env_template['id'], post_body)
98 self.assertEqual(post_body['name'], service['name'])
99 services = self.application_catalog_client.\
100 get_services_list_in_env_template(self.env_template['id'])
101 self.assertIn(service, services)
102 self.application_catalog_client.\
103 delete_service_from_env_template(self.env_template['id'],
104 service['?']['id'])
105 services = self.application_catalog_client.\
106 get_services_list_in_env_template(self.env_template['id'])
107 self.assertNotIn(service, services)
108
109 @decorators.attr(type='smoke')
110 @decorators.idempotent_id('4c409154-f848-42b5-99e4-3d1352d0cf3f')
111 def test_update_service_in_env_templates(self):
112 env_template_services = self.application_catalog_client.\
113 get_services_list_in_env_template(self.env_template['id'])
114 self.assertIsInstance(env_template_services, list)
115 post_body = self._get_demo_app()
116 service = self.application_catalog_client.\
117 create_service_in_env_template(self.env_template['id'], post_body)
118 self.assertEqual(post_body['name'], service['name'])
119 post_body["name"] = "updated_name"
120 service = self.application_catalog_client.\
121 update_service_from_env_template(self.env_template['id'],
122 service["?"]["id"],
123 post_body)
124 self.assertEqual("updated_name", service['name'])
125
126 @decorators.idempotent_id('1fe4b071-8c1f-434a-bb37-0712879df931')
127 def test_create_public_env_template(self):
128 name = utils.generate_name('create_public_env_template')
129 env_template = self.application_catalog_client.\
130 create_public_env_template(name)
131 self.addCleanup(self.application_catalog_client.delete_env_template,
132 env_template['id'])
133 self.assertEqual(name, env_template['name'])
134 env_temp = self.application_catalog_client.\
135 get_env_template(env_template['id'])
136 self.assertTrue(env_temp['is_public'])
137
138 @decorators.idempotent_id('1c79c1dc-c4ff-42d7-9382-6d523f2d9f5b')
139 def test_clone_env_template(self):
140 name = utils.generate_name('clone_env_template')
141 cloned_template = self.alt_client.\
142 clone_env_template(self.env_template['id'], name)
143 self.addCleanup(self.alt_client.delete_env_template,
144 cloned_template['id'])
145 self.assertEqual(name, cloned_template['name'])
146 template = self.alt_client.get_env_template(cloned_template['id'])
147 self.assertEqual(name, template['name'])
148
149 @decorators.idempotent_id('98f889cf-de5e-4cda-a97e-f2eff3b471ce')
150 def test_get_public_private_both_env_templates(self):
151 name = utils.generate_name('get_public_private_both')
152 public_env_template = self.application_catalog_client.\
153 create_public_env_template(name)
154 self.addCleanup(self.application_catalog_client.delete_env_template,
155 public_env_template['id'])
156 self.assertTrue(public_env_template['is_public'])
157 private_name = utils.generate_name('get_public_private_both')
158 private_env_template = self.application_catalog_client.\
159 create_env_template(private_name)
160 self.addCleanup(self.application_catalog_client.delete_env_template,
161 private_env_template['id'])
162 self.assertFalse(private_env_template['is_public'])
163 private_name_alt = utils.generate_name('get_public_private_both')
164 private_alt_env_template = self.alt_client.\
165 create_env_template(private_name_alt)
166 self.addCleanup(self.alt_client.delete_env_template,
167 private_alt_env_template['id'])
168
169 public_env_templates = self.application_catalog_client.\
170 get_public_env_templates_list()
171
172 # Deleting dates from dictionaries to skip it in assert
173 map(lambda x: x.pop('updated', None),
174 public_env_templates + [public_env_template] +
175 [private_env_template] + [private_alt_env_template])
176 map(lambda x: x.pop('created', None),
177 public_env_templates + [public_env_template] +
178 [private_env_template] + [private_alt_env_template])
179
180 self.assertIn(public_env_template, public_env_templates)
181 self.assertNotIn(private_env_template, public_env_templates)
182 self.assertNotIn(private_alt_env_template, public_env_templates)
183
184 private_env_templates = self.application_catalog_client.\
185 get_private_env_templates_list()
186
187 # Deleting dates from dictionaries to skip it in assert
188 map(lambda x: x.pop('updated', None), private_env_templates)
189 map(lambda x: x.pop('created', None), private_env_templates)
190
191 self.assertNotIn(public_env_template, private_env_templates)
192 self.assertIn(private_env_template, private_env_templates)
193 self.assertNotIn(private_alt_env_template, private_env_templates)
194
195 env_templates = self.application_catalog_client.\
196 get_env_templates_list()
197
198 # Deleting dates from dictionaries to skip it in assert
199 map(lambda x: x.pop('updated', None), env_templates)
200 map(lambda x: x.pop('created', None), env_templates)
201
202 self.assertIn(public_env_template, env_templates)
203 self.assertIn(private_env_template, env_templates)
204 self.assertNotIn(private_alt_env_template, env_templates)
205
206 alt_pub_templates = self.alt_client.get_public_env_templates_list()
207
208 # Deleting dates from dictionaries to skip it in assert
209 map(lambda x: x.pop('updated', None), alt_pub_templates)
210 map(lambda x: x.pop('created', None), alt_pub_templates)
211
212 self.assertIn(public_env_template, alt_pub_templates)
213 self.assertNotIn(private_env_template, alt_pub_templates)
214 self.assertNotIn(private_alt_env_template, alt_pub_templates)
215
216 alt_priv_templates = self.alt_client.get_private_env_templates_list()
217
218 # Deleting dates from dictionaries to skip it in assert
219 map(lambda x: x.pop('updated', None), alt_priv_templates)
220 map(lambda x: x.pop('created', None), alt_priv_templates)
221
222 self.assertNotIn(public_env_template, alt_priv_templates)
223 self.assertNotIn(private_env_template, alt_priv_templates)
224 self.assertIn(private_alt_env_template, alt_priv_templates)
225
226 alt_env_templates = self.alt_client.get_env_templates_list()
227
228 # Deleting dates from dictionaries to skip it in assert
229 map(lambda x: x.pop('updated', None), alt_env_templates)
230 map(lambda x: x.pop('created', None), alt_env_templates)
231
232 self.assertIn(public_env_template, alt_env_templates)
233 self.assertNotIn(private_env_template, alt_env_templates)
234 self.assertIn(private_alt_env_template, alt_env_templates)
235
236 @decorators.attr(type='smoke')
237 @decorators.idempotent_id('f7524a15-a4ad-43a5-bcb2-784fd515eb59')
238 def test_create_env_from_template(self):
239 name = utils.generate_name('create_env_from_template')
240 env_template = self.application_catalog_client.\
241 create_public_env_template(name)
242 self.addCleanup(self.application_catalog_client.delete_env_template,
243 env_template['id'])
244 post_body = self._get_demo_app()
245 service = self.application_catalog_client.\
246 create_service_in_env_template(env_template['id'], post_body)
247 self.assertEqual(post_body['name'], service['name'])
248 env_name = utils.generate_name('create_env_from_template')
249 environment = self.application_catalog_client.\
250 create_env_from_template(env_template['id'], env_name)
251 self.addCleanup(self.application_catalog_client.delete_environment,
252 environment['environment_id'])
253 self.assertIsNotNone(environment)
254 service_from_env = self.application_catalog_client.\
255 get_service(environment['environment_id'],
256 service['?']['id'],
257 environment['session_id'])
258 self.assertEqual(service, service_from_env)
diff --git a/murano_tempest_tests/tests/api/application_catalog/test_env_templates_negative.py b/murano_tempest_tests/tests/api/application_catalog/test_env_templates_negative.py
deleted file mode 100644
index 85c6d00..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/test_env_templates_negative.py
+++ /dev/null
@@ -1,133 +0,0 @@
1# Copyright (c) 2015 Telefonica I+D.
2# Copyright (c) 2016 Mirantis, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.lib import decorators
17from tempest.lib import exceptions
18
19from murano_tempest_tests.tests.api.application_catalog import base
20from murano_tempest_tests import utils
21
22
23class TestEnvironmentTemplatesNegative(base.BaseApplicationCatalogTest):
24
25 @classmethod
26 def resource_setup(cls):
27 super(TestEnvironmentTemplatesNegative, cls).resource_setup()
28 cls.name = utils.generate_name(cls.__name__)
29 cls.env_template = cls.application_catalog_client.\
30 create_env_template(cls.name)
31 cls.environment = cls.application_catalog_client.\
32 create_environment(cls.name)
33 cls.alt_client = cls.get_client_with_isolated_creds('alt')
34
35 @classmethod
36 def resource_cleanup(cls):
37 cls.application_catalog_client.\
38 delete_env_template(cls.env_template['id'])
39 cls.application_catalog_client.delete_environment(
40 cls.environment['id'])
41 super(TestEnvironmentTemplatesNegative, cls).resource_cleanup()
42
43 @decorators.attr(type='negative')
44 @decorators.idempotent_id('022d0889-c5b3-4853-934f-533b43dfa89f')
45 def test_clone_env_template_private(self):
46 self.assertRaises(exceptions.Forbidden,
47 self.alt_client.clone_env_template,
48 self.env_template['id'], 'cloned_template')
49
50 @decorators.attr(type='negative')
51 @decorators.idempotent_id('1132afa7-6965-4f48-a4ed-aeedba25ad8c')
52 def test_delete_environment_with_wrong_env_id(self):
53 self.assertRaises(exceptions.NotFound,
54 self.application_catalog_client.delete_env_template,
55 None)
56
57 @decorators.attr(type='negative')
58 @decorators.idempotent_id('a344b0be-d07d-4dfe-916d-900d93e44425')
59 def test_create_environment_with_wrong_payload(self):
60 self.assertRaises(exceptions.BadRequest,
61 self.application_catalog_client.create_env_template,
62 ' ')
63
64 @decorators.attr(type='negative')
65 @decorators.idempotent_id('fa2efa91-75c0-430f-942d-f52fe208cb16')
66 def test_double_delete_env_template(self):
67 name = utils.generate_name('double_delete_env_template')
68 env_template = self.application_catalog_client.\
69 create_env_template(name)
70 self.application_catalog_client.delete_env_template(
71 env_template['id'])
72 self.assertRaises(exceptions.NotFound,
73 self.application_catalog_client.delete_env_template,
74 env_template['id'])
75
76 @decorators.attr(type='negative')
77 @decorators.idempotent_id('3641cfa9-e74e-4e74-af09-6d0c7d4634fc')
78 def test_get_deleted_env_template(self):
79 name = utils.generate_name('get_deleted_env_template')
80 env_template = self.application_catalog_client.\
81 create_env_template(name)
82 self.application_catalog_client.delete_env_template(
83 env_template['id'])
84 self.assertRaises(exceptions.NotFound,
85 self.application_catalog_client.get_env_template,
86 env_template['id'])
87
88 @decorators.attr(type='negative')
89 @decorators.idempotent_id('106fe373-8232-4fb4-870f-290ffa3b475b')
90 def test_create_environment_template_with_same_name(self):
91 self.assertRaises(exceptions.Conflict,
92 self.application_catalog_client.create_env_template,
93 self.name)
94
95 @decorators.attr(type='negative')
96 @decorators.idempotent_id('07f56f09-3ca4-4d2a-8713-6306f2c3c4f8')
97 def test_create_env_from_template_witch_existing_name(self):
98 self.assertRaises(exceptions.Conflict,
99 self.application_catalog_client.
100 create_env_from_template,
101 self.env_template['id'],
102 self.name)
103
104
105class TestEnvTemplatesTenantIsolation(base.BaseApplicationCatalogTest):
106
107 @classmethod
108 def resource_setup(cls):
109 super(TestEnvTemplatesTenantIsolation, cls).resource_setup()
110 name = utils.generate_name(cls.__name__)
111 cls.env_template = cls.application_catalog_client.\
112 create_env_template(name)
113 cls.alt_client = cls.get_client_with_isolated_creds('alt')
114
115 @classmethod
116 def resource_cleanup(cls):
117 cls.application_catalog_client.\
118 delete_env_template(cls.env_template['id'])
119 super(TestEnvTemplatesTenantIsolation, cls).resource_cleanup()
120
121 @decorators.attr(type='negative')
122 @decorators.idempotent_id('bdf6febf-51aa-4b0a-b0e8-645e4df2531c')
123 def test_get_env_template_from_another_tenant(self):
124 self.assertRaises(exceptions.Forbidden,
125 self.alt_client.get_env_template,
126 self.env_template['id'])
127
128 @decorators.attr(type='negative')
129 @decorators.idempotent_id('b664b388-489f-4036-918a-18fa34a2a04e')
130 def test_delete_env_template_from_another_tenant(self):
131 self.assertRaises(exceptions.Forbidden,
132 self.alt_client.delete_env_template,
133 self.env_template['id'])
diff --git a/murano_tempest_tests/tests/api/application_catalog/test_environments.py b/murano_tempest_tests/tests/api/application_catalog/test_environments.py
deleted file mode 100644
index 6aabcb7..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/test_environments.py
+++ /dev/null
@@ -1,128 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15from tempest.lib import decorators
16
17from murano_tempest_tests.tests.api.application_catalog import base
18from murano_tempest_tests import utils
19
20
21class TestEnvironments(base.BaseApplicationCatalogTest):
22
23 @classmethod
24 def resource_setup(cls):
25 super(TestEnvironments, cls).resource_setup()
26 name = utils.generate_name(cls.__name__)
27 cls.environment = cls.application_catalog_client.\
28 create_environment(name)
29
30 @classmethod
31 def resource_cleanup(cls):
32 cls.application_catalog_client.\
33 delete_environment(cls.environment['id'])
34 super(TestEnvironments, cls).resource_cleanup()
35
36 @decorators.attr(type='smoke')
37 @decorators.idempotent_id('32f26f2e-6c55-4e83-9d8c-023d86299d3e')
38 def test_list_environments(self):
39 environments_list = self.application_catalog_client.\
40 get_environments_list()
41 self.assertIsInstance(environments_list, list)
42
43 @decorators.attr(type='smoke')
44 @decorators.idempotent_id('a4c0b2fd-2c1b-473c-80cc-d433ceec4c80')
45 def test_create_and_delete_environment(self):
46 environments_list = self.application_catalog_client.\
47 get_environments_list()
48 name = utils.generate_name('create_and_delete_env')
49 environment = self.application_catalog_client.create_environment(name)
50 self.assertEqual(name, environment['name'])
51 upd_environments_list = self.application_catalog_client.\
52 get_environments_list()
53 self.assertEqual(len(environments_list) + 1,
54 len(upd_environments_list))
55 self.application_catalog_client.delete_environment(environment['id'])
56 upd_environments_list = self.application_catalog_client.\
57 get_environments_list()
58 self.assertEqual(len(environments_list),
59 len(upd_environments_list))
60
61 @decorators.idempotent_id('52a06d5f-69e4-4184-a127-1bb13ce6dc7c')
62 def test_create_and_delete_environment_with_unicode_name(self):
63 environments_list = self.application_catalog_client.\
64 get_environments_list()
65 name = u'$yaql \u2665 unicode'
66 environment = self.application_catalog_client.create_environment(name)
67 self.assertEqual(name, environment['name'])
68 upd_environments_list = self.application_catalog_client.\
69 get_environments_list()
70 self.assertEqual(len(environments_list) + 1,
71 len(upd_environments_list))
72 self.application_catalog_client.delete_environment(environment['id'])
73 upd_environments_list = self.application_catalog_client.\
74 get_environments_list()
75 self.assertEqual(len(environments_list),
76 len(upd_environments_list))
77
78 @decorators.idempotent_id('2b45d30b-3f1d-4482-805e-7cf15d19fe38')
79 def test_get_environment(self):
80 environment = self.application_catalog_client.\
81 get_environment(self.environment['id'])
82 self.assertEqual(self.environment['name'], environment['name'])
83
84 @decorators.attr(type='smoke')
85 @decorators.idempotent_id('950f5bc1-3e5c-48d1-8b05-dc33303ce6f3')
86 def test_update_environment(self):
87 environment = self.application_catalog_client.\
88 update_environment(self.environment['id'])
89 self.assertIsNot(self.environment['name'], environment['name'])
90
91 @decorators.idempotent_id('61001866-e885-4dda-9ac9-5b24c67a0e25')
92 def test_get_environment_model(self):
93 model = self.application_catalog_client.\
94 get_environment_model(self.environment['id'])
95 self.assertIsInstance(model, dict)
96 self.assertIn('defaultNetworks', model)
97 self.assertEqual(self.environment['name'], model['name'])
98 self.assertEqual(model['?']['type'], "io.murano.Environment")
99
100 net_name = self.application_catalog_client.\
101 get_environment_model(self.environment['id'],
102 path='/defaultNetworks/environment/name')
103 self.assertEqual("{0}-network".format(self.environment['name']),
104 net_name)
105
106 @decorators.idempotent_id('23416978-9701-49ff-9bb1-d312292a7f49')
107 def test_update_environment_model(self):
108 session = self.application_catalog_client. \
109 create_session(self.environment['id'])
110 patch = [{
111 "op": "replace",
112 "path": "/defaultNetworks/flat",
113 "value": True
114 }]
115 new_model = self.application_catalog_client. \
116 update_environment_model(self.environment['id'], patch,
117 session['id'])
118 self.assertTrue(new_model['defaultNetworks']['flat'])
119
120 value_draft = self.application_catalog_client. \
121 get_environment_model(self.environment['id'],
122 '/defaultNetworks/flat',
123 session['id'])
124 self.assertTrue(value_draft)
125
126 model_current = self.application_catalog_client. \
127 get_environment_model(self.environment['id'])
128 self.assertIsNone(model_current['defaultNetworks']['flat'])
diff --git a/murano_tempest_tests/tests/api/application_catalog/test_environments_negative.py b/murano_tempest_tests/tests/api/application_catalog/test_environments_negative.py
deleted file mode 100644
index 34934b7..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/test_environments_negative.py
+++ /dev/null
@@ -1,104 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15from tempest.lib import decorators
16from tempest.lib import exceptions
17
18from murano_tempest_tests.tests.api.application_catalog import base
19from murano_tempest_tests import utils
20
21
22class TestEnvironmentsNegative(base.BaseApplicationCatalogTest):
23
24 @decorators.attr(type='negative')
25 @decorators.idempotent_id('9e245625-ce24-4068-916e-20a5608f6d5a')
26 def test_delete_environment_with_wrong_env_id(self):
27 self.assertRaises(exceptions.NotFound,
28 self.application_catalog_client.delete_environment,
29 utils.generate_uuid())
30
31 @decorators.attr(type='negative')
32 @decorators.idempotent_id('1dae123c-27f4-4996-871e-31c66f76ee49')
33 def test_double_delete_environment(self):
34 name = utils.generate_name('double_del_negavive')
35 environment = self.application_catalog_client.\
36 create_environment(name)
37 self.application_catalog_client.delete_environment(environment['id'])
38 self.assertRaises(exceptions.NotFound,
39 self.application_catalog_client.delete_environment,
40 environment['id'])
41
42 @decorators.attr(type='negative')
43 @decorators.idempotent_id('a8032052-5a48-48f0-b333-d1cefcfcbf5f')
44 def test_get_deleted_environment(self):
45 name = utils.generate_name('double_del_negavive')
46 environment = self.application_catalog_client.\
47 create_environment(name)
48 self.application_catalog_client.delete_environment(environment['id'])
49 self.assertRaises(exceptions.NotFound,
50 self.application_catalog_client.get_environment,
51 environment['id'])
52
53 @decorators.attr(type='negative')
54 @decorators.idempotent_id('f0b6102c-dd22-4f4d-9775-ce0a7a53d881')
55 def test_update_environment_with_wrong_env_id(self):
56 self.assertRaises(exceptions.NotFound,
57 self.application_catalog_client.update_environment,
58 None)
59
60 @decorators.attr(type='negative')
61 @decorators.idempotent_id('03266970-2f9d-4b82-971f-532fe23d1027')
62 def test_abandon_environment_with_wrong_env_id(self):
63 self.assertRaises(exceptions.NotFound,
64 self.application_catalog_client.abandon_environment,
65 None)
66
67
68class TestEnvironmentNegativeTenantIsolation(base.BaseApplicationCatalogTest):
69
70 @classmethod
71 def resource_setup(cls):
72 super(TestEnvironmentNegativeTenantIsolation, cls).resource_setup()
73 name = utils.generate_name(cls.__name__)
74 cls.environment = cls.application_catalog_client.\
75 create_environment(name)
76 cls.alt_client = cls.get_client_with_isolated_creds(
77 type_of_creds='alt')
78
79 @classmethod
80 def resource_cleanup(cls):
81 cls.application_catalog_client.\
82 delete_environment(cls.environment['id'])
83 super(TestEnvironmentNegativeTenantIsolation, cls).resource_cleanup()
84
85 @decorators.attr(type='negative')
86 @decorators.idempotent_id('0fc96a16-5df9-48b9-a681-ba5b3730e95b')
87 def test_get_environment_from_another_tenant(self):
88 self.assertRaises(exceptions.Forbidden,
89 self.alt_client.get_environment,
90 self.environment['id'])
91
92 @decorators.attr(type='negative')
93 @decorators.idempotent_id('d3c6dc81-ed60-4346-869c-0a091c2fe5b8')
94 def test_update_environment_from_another_tenant(self):
95 self.assertRaises(exceptions.Forbidden,
96 self.alt_client.update_environment,
97 self.environment['id'])
98
99 @decorators.attr(type='negative')
100 @decorators.idempotent_id('56aea1db-9314-4558-8b97-5fcd35fd6955')
101 def test_delete_environment_from_another_tenant(self):
102 self.assertRaises(exceptions.Forbidden,
103 self.alt_client.delete_environment,
104 self.environment['id'])
diff --git a/murano_tempest_tests/tests/api/application_catalog/test_repository.py b/murano_tempest_tests/tests/api/application_catalog/test_repository.py
deleted file mode 100644
index a8494f2..0000000
--- a/murano_tempest_tests/tests/api/application_catalog/test_repository.py
+++ /dev/null
@@ -1,221 +0,0 @@
1# Copyright (c) 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import os
16
17from tempest import config
18from tempest.lib import decorators
19
20from murano_tempest_tests.tests.api.application_catalog import base
21from murano_tempest_tests import utils
22
23CONF = config.CONF
24
25
26class TestRepositorySanity(base.BaseApplicationCatalogTest):
27
28 @classmethod
29 def resource_setup(cls):
30 if CONF.application_catalog.glare_backend:
31 msg = ("Murano using GLARE backend. "
32 "Repository tests will be skipped.")
33 raise cls.skipException(msg)
34 super(TestRepositorySanity, cls).resource_setup()
35
36 @decorators.attr(type='smoke')
37 @decorators.idempotent_id('d0f3ad6c-70b4-4ce0-90c5-e7afb20ace80')
38 def test_get_list_packages(self):
39 package_list = self.application_catalog_client.get_list_packages()
40 self.assertIsInstance(package_list, list)
41
42 @decorators.attr(type='smoke')
43 @decorators.idempotent_id('53f679d9-955f-4dc1-8cdc-1fcdcfbb07a5')
44 def test_upload_and_delete_package(self):
45 application_name = utils.generate_name('package_test_upload')
46 abs_archive_path, dir_with_archive, archive_name = \
47 utils.prepare_package(application_name)
48 self.addCleanup(os.remove, abs_archive_path)
49 package = self.application_catalog_client.upload_package(
50 application_name, archive_name, dir_with_archive,
51 {"categories": [], "tags": [], 'is_public': False})
52 package_list = self.application_catalog_client.get_list_packages()
53 self.assertIn(package['id'], {pkg['id'] for pkg in package_list})
54 self.application_catalog_client.delete_package(package['id'])
55 package_list = self.application_catalog_client.get_list_packages()
56 self.assertNotIn(package['id'], {pkg['id'] for pkg in package_list})
57
58
59class TestRepository(base.BaseApplicationCatalogIsolatedAdminTest):
60
61 @classmethod
62 def resource_setup(cls):
63 if CONF.application_catalog.glare_backend:
64 msg = ("Murano using GLARE backend. "
65 "Repository tests will be skipped.")
66 raise cls.skipException(msg)
67
68 super(TestRepository, cls).resource_setup()
69
70 application_name = utils.generate_name('test_repository_class')
71 cls.abs_archive_path, dir_with_archive, archive_name = \
72 utils.prepare_package(application_name)
73 cls.package = cls.application_catalog_client.upload_package(
74 application_name, archive_name, dir_with_archive,
75 {"categories": [], "tags": [], 'is_public': False})
76
77 @classmethod
78 def resource_cleanup(cls):
79 os.remove(cls.abs_archive_path)
80 cls.application_catalog_client.delete_package(cls.package['id'])
81 super(TestRepository, cls).resource_cleanup()
82
83 @decorators.idempotent_id('5ea58ef1-1a63-403d-a57a-ef4423202993')
84 def test_get_package(self):
85 package = self.application_catalog_client.get_package(
86 self.package['id'])
87 self.assertEqual(self.package['tags'], package['tags'])
88
89 @decorators.attr(type='smoke')
90 @decorators.idempotent_id('daf5694d-abbf-4ab1-a6df-99540d0efc70')
91 def test_update_package(self):
92 post_body = [
93 {
94 "op": "add",
95 "path": "/tags",
96 "value": ["im a test"]
97 }
98 ]
99
100 result = self.application_catalog_client.update_package(
101 self.package['id'], post_body)
102 self.assertIn("im a test", result['tags'])
103
104 post_body = [