From 9b9cfb76a96da384052c7df0c17f229e4839516f Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Fri, 28 Nov 2025 18:55:16 -0600 Subject: [PATCH] Add a test for the location submodule: Addressing. --- modules/metanix-core.nix | 6 ++++++ tests/addressing-smoke.nix | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 tests/addressing-smoke.nix diff --git a/modules/metanix-core.nix b/modules/metanix-core.nix index 7341968..f5b6f53 100644 --- a/modules/metanix-core.nix +++ b/modules/metanix-core.nix @@ -31,6 +31,12 @@ in description = "System definitions from meta.nix."; }; + policy = mkOption { + type = types.attrs; + readOnly = true; + description = "Policy subtree from meta.nix."; + }; + # Computed addressing network = mkOption { type = types.attrs; diff --git a/tests/addressing-smoke.nix b/tests/addressing-smoke.nix new file mode 100644 index 0000000..7ba2650 --- /dev/null +++ b/tests/addressing-smoke.nix @@ -0,0 +1,36 @@ +let + lib = import { }; + addressing = import ./lib/addressing { inherit lib; }; + + spec = { + domain = "kasear.net"; + + locations = { + home = { + # note: owner/admins/users are *ignored* by mkNetworkFromSpec + owner = "yaro"; + admins = [ "ops" ]; + + main = { + vlan = 10; + hosts = { + deimos = { + role = "server"; + hostId = 1; + }; + + router = { + role = "router"; + hostId = 1; + }; + }; + }; + }; + }; + }; + + network = addressing.mkNetworkFromSpec spec; +in +{ + inherit spec network; +}