vFW and vDNS support added to azure-plugin
[multicloud/azure.git] / azure / aria / aria-extension-cloudify / src / aria / tests / end2end / test_nodecellar.py
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements.  See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License.  You may obtain 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,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 from .testenv import testenv  # pylint: disable=unused-import
17 from .. import helpers
18
19
20 def test_nodecellar(testenv):
21     nodecellar_template_uri = helpers.get_service_template_uri(
22         'tosca-simple-1.0', 'node-cellar', 'node-cellar.yaml')
23
24     service_name = testenv.install_service(nodecellar_template_uri, dry=True)
25     _verify_deployed_service_in_storage(service_name, testenv.model_storage)
26
27     # testing dry execution of custom workflows
28     testenv.execute_workflow(service_name, 'maintenance_on', dry=True)
29     testenv.execute_workflow(service_name, 'maintenance_off', dry=True)
30
31     testenv.uninstall_service(dry=True)
32     testenv.verify_clean_storage()
33
34
35 def _verify_deployed_service_in_storage(service_name, model_storage):
36     service_templates = model_storage.service_template.list()
37     assert len(service_templates) == 1
38     assert len(service_templates[0].services) == 1
39     service = service_templates[0].services[service_name]
40     assert service.name == service_name
41     assert len(service.executions) == 0  # dry executions leave no traces
42     assert len(service.nodes) == 15