"Fossies" - the Fresh Open Source Software Archive

Member "murano-8.0.0/murano/tests/unit/core_library/instance/test_destroy/test_destroy.py" (16 Oct 2019, 2796 Bytes) of package /linux/misc/openstack/murano-8.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # Copyright (c) 2014 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 
   15 from murano.tests.unit.dsl.foundation import object_model as om
   16 from murano.tests.unit.dsl.foundation import test_case
   17 
   18 
   19 TEMPLATE = {
   20     "outputs": {
   21         "instance64464-assigned-ip": {
   22             "value": {"get_attr": ["instance64464", "addresses"]}
   23         },
   24         "instance64464-FloatingIPaddress": {
   25             "value": {"get_attr": ["instance64464", "addresses"]}
   26         }
   27     },
   28     "resources": {
   29         "instance64464": {
   30             "type": "OS::Nova::Server",
   31             "properties": {
   32                 "key_name": None,
   33                 "flavor": "m1.medium",
   34                 "image": "cloud-fedora-v3",
   35             }
   36         }
   37     }
   38 }
   39 
   40 
   41 class TestDestroy(test_case.DslTestCase):
   42     def test_destroy_removes_ip_address_from_outputs(self):
   43         # FIXME(sergmelikyan): Revise this as part of proper fix for #1359998
   44         self.skipTest('skipped until proper fix for #1359998 is proposed')
   45 
   46         heat_stack_obj = om.Object('io.murano.system.HeatStack')
   47         instance_obj = om.Object(
   48             'io.murano.resources.Instance',
   49             name='instance64464',
   50             flavor='m1.medium',
   51             image='cloud-fedora-v3'
   52         )
   53 
   54         runner = self.new_runner({
   55             'Objects': om.Object(
   56                 'io.murano.Environment',
   57                 stack=heat_stack_obj,
   58                 instance=instance_obj
   59             ),
   60             'Attributes': [
   61                 om.Attribute(heat_stack_obj, 'stack', TEMPLATE),
   62                 om.Attribute(instance_obj, 'fipAssigned', True)
   63             ]
   64         })
   65 
   66         empty_env = runner.serialized_model
   67         empty_env['Objects']['instance'] = None
   68         model = self.new_runner(empty_env).serialized_model
   69         template = self.find_attribute(
   70             model, heat_stack_obj.id, heat_stack_obj.type_name, 'stack'
   71         )
   72 
   73         instance_name = 'instance64464'
   74         ip_addresses = '{0}-assigned-ip'.format(instance_name)
   75         floating_ip = '{0}-FloatingIPaddress'.format(instance_name)
   76 
   77         self.assertNotIn(ip_addresses, template['outputs'])
   78         self.assertNotIn(floating_ip, template['outputs'])
   79         self.assertNotIn(instance_name, template['resources'])