diff --git a/hosts/weft/krater-production.nix b/hosts/weft/krater-production.nix index 19bbb36..68285d2 100644 --- a/hosts/weft/krater-production.nix +++ b/hosts/weft/krater-production.nix @@ -7,5 +7,5 @@ # ./krater.nix. With it true and the Weave client id still empty, the weft # build fails on purpose. { - enable = false; + enable = true; } diff --git a/tests/krater-weft.nix b/tests/krater-weft.nix index 9a5168f..e519ad9 100644 --- a/tests/krater-weft.nix +++ b/tests/krater-weft.nix @@ -1,5 +1,5 @@ # Evaluates weft (hosts/weft) as it is: Krater staging on (its Weave client id -# and env file exist), Krater production off (hosts/weft/krater-production.nix). +# and env file exist), Krater production as hosts/weft/krater-production.nix sets it. # Checks the units, the nginx routes and the alastor edge routes. Then turns # staging off, and production on with a placeholder id, to check both # switches, and checks the database schema for both values of the production @@ -56,6 +56,8 @@ let ]; }).config; edge = mkEdge { }; + edgeOff = mkEdge { patchwork.edge.kraterProduction = false; }; + edgeOffToml = edgeOff.environment.etc."traefik/conf.d/patchwork.toml".source; edgeProd = mkEdge { patchwork.edge.kraterProduction = true; }; edgeProdToml = edgeProd.environment.etc."traefik/conf.d/patchwork.toml".source; units = on.systemd.units; @@ -110,11 +112,13 @@ let "storage volume limit" = on.patchwork.services.krater.storage.maxVolumes == 8 && prod.patchwork.services.krater-production.storage.maxVolumes == 8; - "krater is not on skein" = !(skein.config.patchwork.centralDb.apps ? krater); - "production is off by default" = !on.patchwork.services.krater-production.enable; - "no production unit by default" = !(units ? "krater-prod-web.service"); - "no production vhost by default" = !(vhosts ? krater-prod); - "no production secret by default" = !(on.age.secrets ? krater-env); + # Each of these follows the switch file: on and off are both valid states. + "krater is on skein only with the switch" = + (skein.config.patchwork.centralDb.apps ? krater) == switchFile; + "production follows the switch file" = on.patchwork.services.krater-production.enable == switchFile; + "production unit follows the switch file" = (units ? "krater-prod-web.service") == switchFile; + "production vhost follows the switch file" = (vhosts ? krater-prod) == switchFile; + "production secret follows the switch file" = (on.age.secrets ? krater-env) == switchFile; "edge default follows the switch file" = edge.patchwork.edge.kraterProduction == switchFile; "switch off: krater only on hem" = !(schemaOff.central.apps ? krater) @@ -217,8 +221,10 @@ pkgs.runCommand "krater-weft" { } '' # alastor routes both names to weft over the tailnet. grep -F 'Host(`krater-staging.patchworklabs.org`)' ${edgeToml} grep -F 'Host(`krater-staging-storage.patchworklabs.org`)' ${edgeToml} - absent 'Host(`krater.patchworklabs.org`)' ${edgeToml} - absent 'Host(`krater-storage.patchworklabs.org`)' ${edgeToml} + # With the switch off, alastor has no production routes. + absent 'Host(`krater.patchworklabs.org`)' ${edgeOffToml} + absent 'Host(`krater-storage.patchworklabs.org`)' ${edgeOffToml} + grep -F 'Host(`krater-staging.patchworklabs.org`)' ${edgeOffToml} # Production: its own network, image repository, state and ports, and skein. skein="--add-host skein.wildebeest-stargazer.ts.net:100.109.223.51"