feat(integration-vm): vm naming, RAM guard, lease IP parsing
This commit is contained in:
parent
64767ac187
commit
b5d5dffeaf
1 changed files with 21 additions and 0 deletions
|
|
@ -9,3 +9,24 @@ _spec.loader.exec_module(ivm)
|
|||
|
||||
def test_valid_tiers():
|
||||
assert ivm.VALID_TIERS == ("internal", "le-staging", "le-prod-wildcard")
|
||||
|
||||
|
||||
def test_vm_name_prefix_and_suffix():
|
||||
assert ivm.vm_name("askari", "ab12cd34") == "boma-it-askari-ab12cd34"
|
||||
|
||||
def test_vm_name_generates_suffix():
|
||||
n = ivm.vm_name("askari")
|
||||
assert n.startswith("boma-it-askari-") and len(n.split("-")[-1]) == 8
|
||||
|
||||
def test_free_mib_parses_memavailable():
|
||||
sample = "MemTotal: 16331156 kB\nMemAvailable: 8388608 kB\n"
|
||||
assert ivm.free_mib(sample) == 8192
|
||||
|
||||
def test_parse_lease_ip_extracts_ipv4():
|
||||
out = (" Name MAC address Protocol Address\n"
|
||||
"-------------------------------------------------------------------\n"
|
||||
" vnet0 52:54:00:aa:bb:cc ipv4 192.168.150.42/24\n")
|
||||
assert ivm.parse_lease_ip(out) == "192.168.150.42"
|
||||
|
||||
def test_parse_lease_ip_none_when_absent():
|
||||
assert ivm.parse_lease_ip("no leases\n") is None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue