~ubuntu-branches/ubuntu/vivid/heat/vivid

« back to all changes in this revision

Viewing changes to heat/tests/test_neutron_autoscaling.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Corey Bryant
  • Date: 2015-01-06 08:55:22 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20150106085522-4o3hnaff5lacvtrf
Tags: 2015.1~b1-0ubuntu1
[ Chuck Short ]
* Open up for vivid.
* debian/control: Update bzr branch. 
* debian/control: Add python-saharaclient,
  python-osprofiler, python-oslo.middleware, python-oslo.serialization.
* debian/patches/fix-reqirements.patch: Refreshed.
* debian/patches/skip-tests.patch: Updated to skip more tests.
* debian/rules: Skip integration tests.

[ Corey Bryant ]
* New upstream release.
  - d/control: Align requirements with upstream.
  - d/watch: Update uversionmangle for kilo beta naming.
  - d/rules: Generate heat.conf.sample and apply patch before copy.
  - d/rules: Run base tests instead of integration tests.
  - d/p/fix-requirements.patch: Refreshed.
  - d/p/remove-gettextutils-import.patch: Cherry picked from master.
* d/control: Bumped Standards-Version to 3.9.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
from heat.common import template_format
22
22
from heat.db import api as db_api
23
 
from heat.engine.clients.os import glance
24
23
from heat.engine.clients.os import nova
25
24
from heat.engine import environment
26
25
from heat.engine import parser
27
26
from heat.engine.resources import instance
28
27
from heat.engine import template
29
 
from heat.tests.common import HeatTestCase
 
28
from heat.tests import common
30
29
from heat.tests import utils
31
 
from heat.tests.v1_1 import fakes as v1fakes
 
30
from heat.tests.v1_1 import fakes as fakes_v1_1
32
31
 
33
32
 
34
33
as_template = '''
99
98
'''
100
99
 
101
100
 
102
 
class AutoScalingTest(HeatTestCase):
 
101
class AutoScalingTest(common.HeatTestCase):
103
102
    params = {'KeyName': 'test', 'ImageId': 'foo'}
104
103
 
105
104
    def setUp(self):
106
105
        super(AutoScalingTest, self).setUp()
107
106
 
108
107
        self.ctx = utils.dummy_context()
109
 
        self.fc = v1fakes.FakeClient()
 
108
        self.fc = fakes_v1_1.FakeClient()
110
109
 
111
110
        cfg.CONF.set_default('heat_waitcondition_server_url',
112
111
                             'http://server.test:8000/v1/waitcondition')
129
128
 
130
129
        self.m.StubOutWithMock(instance.Instance, 'handle_create')
131
130
        self.m.StubOutWithMock(instance.Instance, 'check_create_complete')
132
 
        self.m.StubOutWithMock(glance.ImageConstraint, "validate")
133
131
 
134
132
    def test_lb(self):
135
133
 
197
195
        vip_ret_block['vip']['id'] = str(uuid.uuid4())
198
196
        vip_ret_block['vip']['status'] = 'ACTIVE'
199
197
 
200
 
        port_block = {
201
 
            'port': {
202
 
                'network_id': network_body['network']['id'],
203
 
                'fixed_ips': [
204
 
                    {
205
 
                        'subnet_id': subnet_body['subnet']['id'],
206
 
                    }
207
 
                ],
208
 
                'admin_state_up': True
209
 
            }
210
 
        }
211
 
        port_ret_block = copy.deepcopy(port_block)
212
 
        port_ret_block['port']['id'] = str(uuid.uuid4())
213
 
 
214
198
        membera_block = {
215
199
            'member': {
216
200
                'protocol_port': 8080,
241
225
        memberc_ret_block = copy.deepcopy(memberc_block)
242
226
        memberc_ret_block['member']['id'] = str(uuid.uuid4())
243
227
 
244
 
        class id_type(object):
245
 
 
246
 
            def __init__(self, id, name):
247
 
                self.id = id
248
 
                self.name = name
249
 
 
250
 
        instances = {}
251
 
 
252
228
        neutronclient.Client.create_health_monitor(mon_block).\
253
229
            AndReturn(mon_ret_block)
254
230
 
277
253
            .AndReturn(False)
278
254
        instance.Instance.check_create_complete(mox.IgnoreArg())\
279
255
            .AndReturn(True)
280
 
 
281
 
        glance.ImageConstraint.validate(
282
 
            mox.IgnoreArg(), mox.IgnoreArg()).MultipleTimes().AndReturn(True)
283
 
 
 
256
        self.stub_ImageConstraint_validate()
 
257
        self.stub_FlavorConstraint_validate()
284
258
        nova.NovaClientPlugin.server_to_ipaddress(
285
259
            mox.IgnoreArg()).AndReturn('1.2.3.4')
286
260
 
287
261
        neutronclient.Client.create_member(membera_block).\
288
262
            AndReturn(membera_ret_block)
289
263
 
290
 
        instances[instid] = membera_ret_block['member']['id']
291
 
 
292
264
        # Start of update
293
265
        parser.Stack.validate()
294
266
        instid = str(uuid.uuid4())
297
269
            .AndReturn(False)
298
270
        instance.Instance.check_create_complete(mox.IgnoreArg())\
299
271
            .AndReturn(True)
300
 
        instances[instid] = memberb_ret_block['member']['id']
301
272
 
302
273
        instid = str(uuid.uuid4())
303
274
        instance.Instance.handle_create().AndReturn(instid)