mirror of
https://github.com/ceph/ceph
synced 2025-02-19 08:57:27 +00:00
65 lines
1.8 KiB
Python
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
|
|
|