~ubuntu-branches/ubuntu/wily/heat/wily-proposed

« back to all changes in this revision

Viewing changes to heat/tests/test_loadbalancer.py

  • Committer: Package Import Robot
  • Author(s): James Page, Corey Bryant, James Page
  • Date: 2015-03-30 11:11:18 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20150330111118-2qpycylx6swu4yhj
Tags: 2015.1~b3-0ubuntu1
[ Corey Bryant ]
* New upstream milestone release for OpenStack kilo:
  - d/control: Align with upstream dependencies.
  - d/p/sudoers_patch.patch: Rebased.
  - d/p/fix-requirements.patch: Rebased.

[ James Page ]
* d/p/fixup-assert-regex.patch: Tweak test to use assertRegexpMatches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
import copy
15
15
 
16
16
import mock
17
 
from oslo.config import cfg
 
17
from oslo_config import cfg
18
18
 
19
19
from heat.common import exception
20
20
from heat.common import template_format
21
21
from heat.engine.clients.os import nova
22
 
from heat.engine.resources import loadbalancer as lb
 
22
from heat.engine.resources.aws.lb import loadbalancer as lb
23
23
from heat.engine import rsrc_defn
24
24
from heat.tests import common
25
25
from heat.tests import utils
35
35
      "Description" : "KeyName",
36
36
      "Type" : "String",
37
37
      "Default" : "test"
 
38
    },
 
39
    "LbFlavor" : {
 
40
      "Description" : "Flavor to use for LoadBalancer instance",
 
41
      "Type": "String",
 
42
      "Default": "m1.heat"
38
43
    }
39
44
   },
40
45
  "Resources": {
148
153
        rsrc = self.setup_loadbalancer()
149
154
        self.assertRaises(exception.StackValidationFailed, rsrc.validate)
150
155
 
151
 
    def setup_loadbalancer(self, include_keyname=True):
 
156
    def setup_loadbalancer(self, include_magic=True):
152
157
        template = template_format.parse(lb_template)
153
 
        if not include_keyname:
 
158
        if not include_magic:
154
159
            del template['Parameters']['KeyName']
 
160
            del template['Parameters']['LbFlavor']
155
161
        stack = utils.parse_stack(template)
156
162
 
157
163
        resource_name = 'LoadBalancer'
184
190
 
185
191
    def test_child_params_without_key_name(self):
186
192
        rsrc = self.setup_loadbalancer(False)
187
 
        self.assertEqual({}, rsrc.child_params())
 
193
        self.assertNotIn('KeyName', rsrc.child_params())
188
194
 
189
195
    def test_child_params_with_key_name(self):
190
196
        rsrc = self.setup_loadbalancer()
210
216
 
211
217
        self.assertEqual('foo', rsrc.child_template())
212
218
 
 
219
    def test_child_params_with_flavor(self):
 
220
        rsrc = self.setup_loadbalancer()
 
221
        params = rsrc.child_params()
 
222
        self.assertEqual('m1.heat', params['LbFlavor'])
 
223
 
 
224
    def test_child_params_without_flavor(self):
 
225
        rsrc = self.setup_loadbalancer(False)
 
226
        params = rsrc.child_params()
 
227
        self.assertNotIn('LbFlavor', params)
 
228
 
213
229
 
214
230
class HaProxyConfigTest(common.HeatTestCase):
215
231
    def setUp(self):