31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
"""Seed spine objects must not be deletable by probe traffic."""
|
|
|
|
import pytest
|
|
|
|
from app.vsphere.domain.inventory_ops import _SEED_PROTECTED_MOIDS, _is_seed_host_or_named_vm
|
|
from app.vsphere.inventory import ManagedObject
|
|
|
|
|
|
def test_seed_spine_includes_root_pool_and_named_vms() -> None:
|
|
assert "resgroup-22" in _SEED_PROTECTED_MOIDS
|
|
assert "domain-c21" in _SEED_PROTECTED_MOIDS
|
|
assert "vm-101" in _SEED_PROTECTED_MOIDS
|
|
assert "network-41" in _SEED_PROTECTED_MOIDS
|
|
|
|
|
|
@pytest.mark.parametrize("moid", ["host-11", "host-20", "host-30"])
|
|
def test_seed_hosts_are_protected(moid: str) -> None:
|
|
obj = ManagedObject(moid=moid, type="HostSystem", name="esxi", parent_moid="domain-c21", props={})
|
|
assert _is_seed_host_or_named_vm(moid, obj)
|
|
|
|
|
|
def test_probe_host_pattern_not_protected() -> None:
|
|
obj = ManagedObject(
|
|
moid="host-probe",
|
|
type="HostSystem",
|
|
name="probe",
|
|
parent_moid="domain-c21",
|
|
props={},
|
|
)
|
|
assert not _is_seed_host_or_named_vm("host-probe", obj)
|