2013-07-25 21:45:02 +00:00
|
|
|
from .. import misc as teuthology
|
|
|
|
|
2014-09-25 21:22:06 +00:00
|
|
|
class Mock: pass
|
2013-07-25 21:45:02 +00:00
|
|
|
|
2014-09-23 15:50:40 +00:00
|
|
|
class TestGetDistro(object):
|
2014-09-25 21:22:06 +00:00
|
|
|
|
2013-07-25 21:45:02 +00:00
|
|
|
def setup(self):
|
|
|
|
self.fake_ctx = Mock()
|
|
|
|
self.fake_ctx.config = {}
|
2014-09-25 21:22:06 +00:00
|
|
|
self.fake_ctx.os_type = 'ubuntu'
|
2013-07-25 21:45:02 +00:00
|
|
|
|
|
|
|
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):
|
2014-09-25 21:22:06 +00:00
|
|
|
self.fake_ctx.config = {'downburst' : {'distro': 'sles'}}
|
2013-07-25 21:45:02 +00:00
|
|
|
distro = teuthology.get_distro(self.fake_ctx)
|
|
|
|
assert distro == 'sles'
|