~gnuoy/charms/trusty/nova-compute/1496746

« back to all changes in this revision

Viewing changes to tests/basic_deployment.py

  • Committer: Corey Bryant
  • Date: 2015-07-14 19:48:48 UTC
  • mfrom: (139.1.10 nova-compute)
  • Revision ID: corey.bryant@canonical.com-20150714194848-6f26xaiakm6or2tj
[corey.bryant,trivial] Amulet and deploy from source updates

* Enable tests/017-basic-trusty-kilo and update tests for kilo.
* Install amulet requirement python-distro-info.
* Use icehouse repositories with modified requirements due to issues
  with final upstream icehouse requirements.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
        nova_config = {'config-flags': 'auto_assign_floating_ip=False',
71
71
                       'enable-live-migration': 'False'}
72
72
        if self.git:
73
 
            release = self._get_openstack_release_string()
74
 
            reqs_branch = 'stable/' + release
 
73
            amulet_http_proxy = os.environ.get('AMULET_HTTP_PROXY')
 
74
 
 
75
            reqs_repo = 'git://github.com/openstack/requirements'
 
76
            nova_repo = 'git://github.com/openstack/nova'
75
77
            if self._get_openstack_release() == self.trusty_icehouse:
76
 
                nova_branch = release + '-eol'
77
 
            else:
78
 
                nova_branch = 'stable/' + release
79
 
            amulet_http_proxy = os.environ.get('AMULET_HTTP_PROXY')
 
78
                reqs_repo = 'git://github.com/coreycb/requirements'
 
79
                nova_repo = 'git://github.com/coreycb/nova'
 
80
 
 
81
            branch = 'stable/' + self._get_openstack_release_string()
 
82
 
80
83
            openstack_origin_git = {
81
84
                'repositories': [
82
85
                    {'name': 'requirements',
83
 
                     'repository': 'git://github.com/openstack/requirements',
84
 
                     'branch': reqs_branch},
 
86
                     'repository': reqs_repo, 
 
87
                     'branch': branch},
85
88
                    {'name': 'nova',
86
 
                     'repository': 'git://github.com/openstack/nova',
87
 
                     'branch': nova_branch},
 
89
                     'repository': nova_repo,
 
90
                     'branch': branch},
88
91
                ],
89
92
                'directory': '/mnt/openstack-git',
90
93
                'http_proxy': amulet_http_proxy,
182
185
        if self._get_openstack_release() >= self.precise_folsom:
183
186
            endpoint_vol['id'] = u.not_null
184
187
            endpoint_id['id'] = u.not_null
185
 
        expected = {'s3': [endpoint_vol], 'compute': [endpoint_vol],
186
 
                    'ec2': [endpoint_vol], 'identity': [endpoint_id]}
 
188
        if self._get_openstack_release() >= self.trusty_kilo:
 
189
            expected = {'compute': [endpoint_vol], 'identity': [endpoint_id]}
 
190
        else:
 
191
            expected = {'s3': [endpoint_vol], 'compute': [endpoint_vol],
 
192
                        'ec2': [endpoint_vol], 'identity': [endpoint_id]}
187
193
        actual = self.keystone_demo.service_catalog.get_endpoints()
188
194
 
189
195
        ret = u.validate_svc_catalog_endpoint_data(expected, actual)
209
215
 
210
216
    def test_ec2_api_endpoint(self):
211
217
        """Verify the EC2 api endpoint data."""
 
218
        if self._get_openstack_release() >= self.trusty_kilo:
 
219
            return
 
220
 
212
221
        endpoints = self.keystone.endpoints.list()
213
222
        admin_port = internal_port = public_port = '8773'
214
223
        expected = {'id': u.not_null,
226
235
 
227
236
    def test_s3_api_endpoint(self):
228
237
        """Verify the S3 api endpoint data."""
 
238
        if self._get_openstack_release() >= self.trusty_kilo:
 
239
            return
 
240
 
229
241
        endpoints = self.keystone.endpoints.list()
230
242
        admin_port = internal_port = public_port = '3333'
231
243
        expected = {'id': u.not_null,
382
394
                                              mysql_relation['db_host'],
383
395
                                              'nova')
384
396
 
385
 
        expected = {'dhcpbridge_flagfile': '/etc/nova/nova.conf',
386
 
                    'dhcpbridge': '/usr/bin/nova-dhcpbridge',
387
 
                    'logdir': '/var/log/nova',
388
 
                    'state_path': '/var/lib/nova',
389
 
                    'lock_path': '/var/lock/nova',
390
 
                    'force_dhcp_release': 'True',
391
 
                    'libvirt_use_virtio_for_bridges': 'True',
392
 
                    'verbose': 'False',
393
 
                    'use_syslog': 'False',
394
 
                    'ec2_private_dns_show_ip': 'True',
395
 
                    'api_paste_config': '/etc/nova/api-paste.ini',
396
 
                    'enabled_apis': 'ec2,osapi_compute,metadata',
397
 
                    'auth_strategy': 'keystone',
398
 
                    'compute_driver': 'libvirt.LibvirtDriver',
399
 
                    'sql_connection': db_uri,
 
397
        expected = {
 
398
            'DEFAULT': {
 
399
                'dhcpbridge_flagfile': '/etc/nova/nova.conf',
 
400
                'dhcpbridge': '/usr/bin/nova-dhcpbridge',
 
401
                'logdir': '/var/log/nova',
 
402
                'state_path': '/var/lib/nova',
 
403
                'force_dhcp_release': 'True',
 
404
                'verbose': 'False',
 
405
                'use_syslog': 'False',
 
406
                'ec2_private_dns_show_ip': 'True',
 
407
                'api_paste_config': '/etc/nova/api-paste.ini',
 
408
                'enabled_apis': 'ec2,osapi_compute,metadata',
 
409
                'auth_strategy': 'keystone',
 
410
                'flat_interface': 'eth1',
 
411
                'network_manager': 'nova.network.manager.FlatDHCPManager',
 
412
                'volume_api_class': 'nova.volume.cinder.API',
 
413
            }
 
414
        }
 
415
        if self._get_openstack_release() < self.trusty_kilo:
 
416
            d = 'DEFAULT'
 
417
            expected[d]['lock_path'] = '/var/lock/nova'
 
418
            expected[d]['libvirt_use_virtio_for_bridges'] = 'True'
 
419
            expected[d]['compute_driver'] = 'libvirt.LibvirtDriver'
 
420
            expected[d]['sql_connection'] = db_uri
 
421
            expected[d]['rabbit_userid'] = 'nova'
 
422
            expected[d]['rabbit_virtual_host'] = 'openstack'
 
423
            expected[d]['rabbit_password'] = rabbitmq_relation['password']
 
424
            expected[d]['rabbit_host'] = rabbitmq_relation['hostname']
 
425
            expected[d]['glance_api_servers'] = glance_relation['glance-api-server']
 
426
        else:
 
427
            oslo_concurrency = {
 
428
                'oslo_concurrency': {
 
429
                    'lock_path': '/var/lock/nova'
 
430
                }
 
431
            }
 
432
            database = {
 
433
                'database': {
 
434
                    'connection': db_uri
 
435
                }
 
436
            }
 
437
            oslo_messaging_rabbit = {
 
438
                'oslo_messaging_rabbit': {
400
439
                    'rabbit_userid': 'nova',
401
440
                    'rabbit_virtual_host': 'openstack',
402
441
                    'rabbit_password': rabbitmq_relation['password'],
403
442
                    'rabbit_host': rabbitmq_relation['hostname'],
404
 
                    'glance_api_servers': glance_relation['glance-api-server'],
405
 
                    'flat_interface': 'eth1',
406
 
                    'network_manager': 'nova.network.manager.FlatDHCPManager',
407
 
                    'volume_api_class': 'nova.volume.cinder.API'}
 
443
                }
 
444
            }
 
445
            glance = {
 
446
                'glance': {
 
447
                    'api_servers': glance_relation['glance-api-server']
 
448
                }
 
449
            }
 
450
            expected.update(oslo_concurrency)
 
451
            expected.update(database)
 
452
            expected.update(oslo_messaging_rabbit)
 
453
            expected.update(glance)
408
454
 
409
 
        ret = u.validate_config_data(unit, conf, 'DEFAULT', expected)
410
 
        if ret:
411
 
            message = "nova config error: {}".format(ret)
412
 
            amulet.raise_status(amulet.FAIL, msg=message)
 
455
        for section, pairs in expected.iteritems():
 
456
            ret = u.validate_config_data(unit, conf, section, pairs)
 
457
            if ret:
 
458
                message = "nova config error: {}".format(ret)
 
459
                amulet.raise_status(amulet.FAIL, msg=message)
413
460
 
414
461
    def test_image_instance_create(self):
415
462
        """Create an image/instance, verify they exist, and delete them."""