~gnuoy/charms/trusty/nova-compute/no-hugepages

« back to all changes in this revision

Viewing changes to unit_tests/test_nova_compute_utils.py

  • Committer: James Page
  • Date: 2015-10-02 10:33:33 UTC
  • mfrom: (146.1.23 nova-compute)
  • Revision ID: james.page@ubuntu.com-20151002103333-ttw3b5by658vmpiq
Update for the latest and greatest LXD updates in wily

Show diffs side-by-side

added added

removed removed

Lines of Context:
463
463
                                     compute_context.CEPH_SECRET_UUID,
464
464
                                     '--base64', key])
465
465
 
466
 
    @patch.object(utils, 'check_call')
467
 
    @patch.object(utils, 'check_output')
468
 
    def test_configure_lxd_daemon(self, _check_output, _check_call):
469
 
        self.test_config.set('virt-type', 'lxd')
470
 
        utils.configure_lxd_daemon('nova')
471
 
        self.add_user_to_group.assert_called_with('nova', 'lxd')
472
 
        self.service_restart.assert_called_with('lxd')
473
 
        _check_output.assert_called_wth(['sudo', '-u', 'nova', 'lxc', 'list'])
474
 
 
475
 
    @patch.object(utils, 'configure_lxd_daemon')
476
466
    @patch.object(utils, 'configure_subuid')
477
 
    def test_configure_lxd_vivid(self, _configure_subuid,
478
 
                                 _configure_lxd_daemon):
 
467
    def test_configure_lxd_vivid(self, _configure_subuid):
479
468
        self.lsb_release.return_value = {
480
469
            'DISTRIB_CODENAME': 'vivid'
481
470
        }
482
471
        utils.configure_lxd('nova')
483
472
        _configure_subuid.assert_called_with(user='nova')
484
 
        _configure_lxd_daemon.assert_called_with(user='nova')
485
473
 
486
 
    @patch.object(utils, 'configure_lxd_daemon')
487
474
    @patch.object(utils, 'configure_subuid')
488
 
    def test_configure_lxd_pre_vivid(self, _configure_subuid,
489
 
                                     _configure_lxd_daemon):
 
475
    def test_configure_lxd_pre_vivid(self, _configure_subuid):
490
476
        self.lsb_release.return_value = {
491
477
            'DISTRIB_CODENAME': 'trusty'
492
478
        }
493
479
        with self.assertRaises(Exception):
494
480
            utils.configure_lxd('nova')
495
481
        self.assertFalse(_configure_subuid.called)
496
 
        self.assertFalse(_configure_lxd_daemon.called)
497
482
 
498
483
    def test_enable_nova_metadata(self):
499
484
        class DummyContext():