ceph/teuthology/test/test_get_distro_version.py
Sandon Van Ness d4a632df5f Support --os-version as argument.
You can use --os-type as an argument when not running teuthology
tests but instead just using teuthology-lock. This adds the ability
to also use --os-version so you can specify the version of the
distro without having to run an actual test with a yaml like you
normally would have had to do setting os_version in the yaml.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
2013-10-25 17:48:50 -07:00

47 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.os_version = '13.04'
self.fake_ctx_noarg = Mock()
self.fake_ctx_noarg.config = {}
def test_default_distro_version(self):
distroversion = teuthology.get_distro_version(self.fake_ctx)
assert distroversion == '13.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):
self.fake_ctx.config = {'os_version': '13.04'}
distroversion = teuthology.get_distro_version(self.fake_ctx)
assert distroversion == '13.04'
def test_teuth_config_downburst_version(self):
self.fake_ctx.config = {'downburst' : {'distroversion': '13.04'}}
distroversion = teuthology.get_distro_version(self.fake_ctx)
assert distroversion == '13.04'
def test_default_distro_noarg_version(self):
distroversion = teuthology.get_distro_version(self.fake_ctx_noarg)
#Default distro is ubuntu, default version of ubuntu is 012.04
assert distroversion == '12.04'
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'