mirror of
https://github.com/ceph/ceph
synced 2024-12-26 13:33:57 +00:00
90161a371e
Since the default OS version is different for each distro the argument default is None instead of explicity set to a value like with get_distro. Fixed some logic around that and the tests making the arugment always take precidence. Signed-off-by: Sandon Van Ness <sandon@inktank.com>
48 lines
1.8 KiB
Python
48 lines
1.8 KiB
Python
from .. import misc as teuthology
|
|
|
|
class Mock: pass
|
|
|
|
class TestGetDistroVersion(object):
|
|
|
|
def setup(self):
|
|
self.fake_ctx = Mock()
|
|
self.fake_ctx.config = {}
|
|
self.fake_ctx_noarg = Mock()
|
|
self.fake_ctx_noarg.config = {}
|
|
self.fake_ctx_noarg.os_version = None
|
|
|
|
def test_default_distro_version(self):
|
|
#Default distro is ubuntu, default version of ubuntu is 12.04
|
|
self.fake_ctx.os_version = None
|
|
distroversion = teuthology.get_distro_version(self.fake_ctx)
|
|
assert distroversion == '12.04'
|
|
|
|
def test_argument_version(self):
|
|
self.fake_ctx.os_version = '13.04'
|
|
distroversion = teuthology.get_distro_version(self.fake_ctx)
|
|
assert distroversion == '13.04'
|
|
|
|
def test_teuth_config_version(self):
|
|
#Argument takes precidence.
|
|
self.fake_ctx.os_version = '13.04'
|
|
self.fake_ctx.config = {'os_version': '13.10'}
|
|
distroversion = teuthology.get_distro_version(self.fake_ctx)
|
|
assert distroversion == '13.04'
|
|
|
|
def test_teuth_config_downburst_version(self):
|
|
#Argument takes precidence
|
|
self.fake_ctx.os_version = '13.10'
|
|
self.fake_ctx.config = {'downburst' : {'distroversion': '13.04'}}
|
|
distroversion = teuthology.get_distro_version(self.fake_ctx)
|
|
assert distroversion == '13.10'
|
|
|
|
def test_teuth_config_noarg_version(self):
|
|
self.fake_ctx_noarg.config = {'os_version': '13.04'}
|
|
distroversion = teuthology.get_distro_version(self.fake_ctx_noarg)
|
|
assert distroversion == '13.04'
|
|
|
|
def test_teuth_config_downburst_noarg_version(self):
|
|
self.fake_ctx_noarg.config = {'downburst' : {'distroversion': '13.04'}}
|
|
distroversion = teuthology.get_distro_version(self.fake_ctx_noarg)
|
|
assert distroversion == '13.04'
|