INNER CODE UNIT · Python

test_host_bits_error_suggests_network_address

onedr0p/cluster-template · template/scripts/test_validate.py:56

def test_host_bits_error_suggests_network_address():
    raw = config_from("public.toml", **{"network.node_cidr": "10.10.10.5/24"})
    with pytest.raises(ConfigError, match=r"did you mean 10\.10\.10\.0/24"):
        _load_raw(raw)


def test_duplicate_address_names_both_owners():
    raw = config_from("public.toml")
    raw["nodes"][0]["address"] = raw["gateways"]["internal"]
    with pytest.raises(ConfigError, match=r"gateways\.internal and nodes\[0\]\.address"):
        _load_raw(raw)


def test_default_gateway_derived_from_node_cidr():
    raw = config_from("private.toml")
    assert "default_gateway" not in raw["network"]
    data = _load_raw(raw).model_dump(mode="json")
    assert data["network"]["default_gateway"] == "10.10.10.1"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…