mirror of
https://github.com/ceph/ceph
synced 2025-01-19 01:21:49 +00:00
Merge pull request #7025 from tchaikov/wip-ceph-detect-init-py3
ceph-detect-init: fix py3 test Reviewed-by: Loic Dachary <ldachary@redhat.com>
This commit is contained in:
commit
bea2e10a00
@ -8,6 +8,7 @@ def choose_init():
|
||||
|
||||
Returns the name of a init system (upstart, sysvinit ...).
|
||||
"""
|
||||
assert(distro and codename)
|
||||
if distro.lower() in ('ubuntu', 'linuxmint'):
|
||||
if codename >= 'vivid':
|
||||
return 'systemd'
|
||||
|
@ -44,15 +44,18 @@ class TestCephDetectInit(testtools.TestCase):
|
||||
self.assertEqual('sysvinit', centos.choose_init())
|
||||
|
||||
def test_debian(self):
|
||||
with mock.patch('ceph_detect_init.debian.distro',
|
||||
'debian'):
|
||||
with mock.patch.multiple('ceph_detect_init.debian',
|
||||
distro='debian',
|
||||
codename='wheezy'):
|
||||
self.assertEqual('sysvinit', debian.choose_init())
|
||||
with mock.patch('ceph_detect_init.debian.distro',
|
||||
'ubuntu'):
|
||||
with mock.patch.multiple('ceph_detect_init.debian',
|
||||
distro='ubuntu',
|
||||
codename='trusty'):
|
||||
self.assertEqual('upstart', debian.choose_init())
|
||||
with mock.patch('ceph_detect_init.debian.codename',
|
||||
'vivid'):
|
||||
self.assertEqual('systemd', debian.choose_init())
|
||||
with mock.patch.multiple('ceph_detect_init.debian',
|
||||
distro='ubuntu',
|
||||
codename='vivid'):
|
||||
self.assertEqual('systemd', debian.choose_init())
|
||||
|
||||
def test_fedora(self):
|
||||
with mock.patch('ceph_detect_init.fedora.release',
|
||||
|
Loading…
Reference in New Issue
Block a user