mirror of
https://github.com/ceph/ceph
synced 2024-12-22 03:22:00 +00:00
810cca1daf
Since getting the ostype is used multiple places I made a function for it and modified the existing code to use said function. I also added tests for the function. Signed-off-by: Sandon Van Ness <sandon@inktank.com>
30 lines
864 B
Python
30 lines
864 B
Python
from .. import misc as teuthology
|
|
|
|
class Mock: pass
|
|
|
|
class TestGetDistro(object):
|
|
|
|
def setup(self):
|
|
self.fake_ctx = Mock()
|
|
self.fake_ctx.config = {}
|
|
self.fake_ctx.os_type = 'ubuntu'
|
|
|
|
def test_default_distro(self):
|
|
distro = teuthology.get_distro(self.fake_ctx)
|
|
assert distro == 'ubuntu'
|
|
|
|
def test_argument(self):
|
|
self.fake_ctx.os_type = 'centos'
|
|
distro = teuthology.get_distro(self.fake_ctx)
|
|
assert distro == 'centos'
|
|
|
|
def test_teuth_config(self):
|
|
self.fake_ctx.config = {'os_type': 'fedora'}
|
|
distro = teuthology.get_distro(self.fake_ctx)
|
|
assert distro == 'fedora'
|
|
|
|
def test_teuth_config_downburst(self):
|
|
self.fake_ctx.config = {'downburst' : {'distro': 'sles'}}
|
|
distro = teuthology.get_distro(self.fake_ctx)
|
|
assert distro == 'sles'
|