本文整理汇总了Python中charms.layer.apache_bigtop_base.Bigtop.pin_bigtop_packages方法的典型用法代码示例。如果您正苦于以下问题:Python Bigtop.pin_bigtop_packages方法的具体用法?Python Bigtop.pin_bigtop_packages怎么用?Python Bigtop.pin_bigtop_packages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类charms.layer.apache_bigtop_base.Bigtop
的用法示例。
在下文中一共展示了Bigtop.pin_bigtop_packages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestBigtopUnit
# 需要导入模块: from charms.layer.apache_bigtop_base import Bigtop [as 别名]
# 或者: from charms.layer.apache_bigtop_base.Bigtop import pin_bigtop_packages [as 别名]
class TestBigtopUnit(Harness):
'''
Unit tests for Bigtop class.
'''
@mock.patch('charms.layer.apache_bigtop_base.hookenv')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.bigtop_version',
new_callable=mock.PropertyMock)
def setUp(self, mock_ver, mock_hookenv):
mock_ver.return_value = '1.2.0'
super(TestBigtopUnit, self).setUp()
self.bigtop = Bigtop()
def test_init(self):
'''
Verify that the Bigtop class can init itself, and that it has some
of the properties that we expect..
'''
# paths should be Path objects.
self.assertEqual(type(self.bigtop.bigtop_base), Path)
self.assertEqual(type(self.bigtop.site_yaml), Path)
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.render_hiera_yaml')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.apply_patches')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.install_puppet_modules')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.fetch_bigtop_release')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.check_reverse_dns')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.check_localdomain')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.pin_bigtop_packages')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.install_java')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.install_swap')
@mock.patch('charms.layer.apache_bigtop_base.is_container')
def test_install(self, mock_container, mock_swap, mock_java, mock_pin,
mock_local, mock_dns, mock_fetch, mock_puppet, mock_apply,
mock_hiera):
'''
Verify install calls expected class methods.
'''
mock_container.return_value = False
self.bigtop.install()
self.assertTrue(mock_swap.called)
self.assertTrue(mock_java.called)
self.assertTrue(mock_pin.called)
self.assertTrue(mock_local.called)
self.assertTrue(mock_dns.called)
self.assertTrue(mock_fetch.called)
self.assertTrue(mock_puppet.called)
self.assertTrue(mock_apply.called)
self.assertTrue(mock_hiera.called)
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.update_bigtop_repo')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.apply_patches')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.fetch_bigtop_release')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.pin_bigtop_packages')
def test_refresh_bigtop_release(self, mock_pin, mock_fetch, mock_apply,
mock_update):
'''
Verify refresh calls expected class methods.
'''
self.bigtop.refresh_bigtop_release()
self.assertTrue(mock_pin.called)
self.assertTrue(mock_fetch.called)
self.assertTrue(mock_apply.called)
self.assertTrue(mock_update.called)
@mock.patch('charms.layer.apache_bigtop_base.hookenv')
@mock.patch('charms.layer.apache_bigtop_base.utils')
@mock.patch('charms.layer.apache_bigtop_base.lsb_release')
@mock.patch('charms.layer.apache_bigtop_base.Bigtop.bigtop_version',
new_callable=mock.PropertyMock)
def test_get_repo_url(self, mock_ver, mock_lsb_release,
mock_utils, mock_hookenv):
'''
Verify that we setup an appropriate repository.
'''
mock_ver.return_value = '1.1.0'
# non-ubuntu should throw an exception
mock_lsb_release.return_value = {'DISTRIB_ID': 'centos'}
self.assertRaises(
BigtopError,
self.bigtop.get_repo_url,
'1.1.0')
# 1.1.0 on trusty/non-power
mock_utils.cpu_arch.return_value = 'foo'
mock_lsb_release.return_value = {'DISTRIB_ID': 'ubuntu'}
self.assertEqual(self.bigtop.get_repo_url('1.1.0'),
('http://bigtop-repos.s3.amazonaws.com/releases/'
'1.1.0/ubuntu/trusty/foo'))
# 1.1.0 on trusty/power (should return vivid url)
mock_utils.cpu_arch.return_value = 'ppc64le'
self.assertEqual(self.bigtop.get_repo_url('1.1.0'),
('http://bigtop-repos.s3.amazonaws.com/releases/'
#.........这里部分代码省略.........