ceph/teuthology/test/test_vps_os_vers_parameter_checking.py
Zack Cerza f39b6958c4 Add os_type and os_version args to lock_many()
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-09-25 09:46:07 -06:00

65 lines
1.8 KiB
Python

from .. import lock
class Mock:
pass
class TestVpsOsVersionParamCheck(object):
def setup(self):
self.fake_ctx = Mock()
self.fake_ctx.machine_type = 'vps'
self.fake_ctx.num_to_lock = 1
self.fake_ctx.lock = False
def test_ubuntu_precise(self):
self.fake_ctx.os_type = 'ubuntu'
self.fake_ctx.os_version = 'precise'
check_value = lock.validate_os_type_and_version(
self.fake_ctx,
self.fake_ctx.machine_type)
assert check_value
def test_ubuntu_number(self):
self.fake_ctx.os_type = 'ubuntu'
self.fake_ctx.os_version = '12.04'
check_value = lock.validate_os_type_and_version(
self.fake_ctx,
self.fake_ctx.machine_type)
assert check_value
def test_rhel(self):
self.fake_ctx.os_type = 'rhel'
self.fake_ctx.os_version = '6.5'
check_value = lock.validate_os_type_and_version(
self.fake_ctx,
self.fake_ctx.machine_type)
assert check_value
def test_mixup(self):
self.fake_ctx.os_type = '6.5'
self.fake_ctx.os_version = 'rhel'
check_value = lock.validate_os_type_and_version(
self.fake_ctx,
self.fake_ctx.machine_type)
assert not check_value
def test_bad_type(self):
self.fake_ctx.os_type = 'aardvark'
self.fake_ctx.os_version = '6.5'
check_value = lock.validate_os_type_and_version(
self.fake_ctx,
self.fake_ctx.machine_type)
assert not check_value
def test_bad_version(self):
self.fake_ctx.os_type = 'rhel'
self.fake_ctx.os_version = 'vampire_bat'
check_value = lock.validate_os_type_and_version(
self.fake_ctx,
self.fake_ctx.machine_type)
assert not check_value