nix: stop three defaults from consulting hyperhive.enable
hive-forge's publicUrl and behindGateway, and swarm-controller's forgeTokenFile, no longer gate their default on config.services.hyperhive.enable — none of the three has a reader that depends on hyperhive being enabled to make sense of the value, so the extra condition only added a hidden coupling. module-eval.nix gains a centralToggleOff fixture plus four cases asserting each affected default now resolves identically whether the toggle is on or off. Refs #4500
This commit is contained in:
parent
837e658d4a
commit
c5f60fd58f
4 changed files with 63 additions and 27 deletions
|
|
@ -97,6 +97,15 @@ let
|
|||
|
||||
allLocal = hive { deploy.singleHostSwarm = true; };
|
||||
bare = hive { };
|
||||
|
||||
# The same stub with the central toggle off. Paired with `bare` below to pin
|
||||
# the defaults that used to read `services.hyperhive.enable` and no longer
|
||||
# do: each is asserted to hold the SAME literal in both, so a future edit
|
||||
# that quietly re-introduces the dependency — or that changes what the
|
||||
# default renders for a hive with the toggle on — fails here. Reading an
|
||||
# option off this fixture forces that option only, not the config, so the
|
||||
# toggle being off costs nothing.
|
||||
centralToggleOff = hive { enable = false; };
|
||||
withCi = hive { deploy.forgejo.ci.enable = true; };
|
||||
|
||||
# A host configured against the pre-rename option path. `mkRenamedOptionModule`
|
||||
|
|
@ -781,6 +790,44 @@ let
|
|||
|
||||
# Each case: a name stating the property, and `ok`.
|
||||
cases = [
|
||||
{
|
||||
# Both halves matter. The equality is the "no longer consults the central
|
||||
# toggle" half; the literal is the "and still renders what it always
|
||||
# did" half, which an equality on its own would let drift to `false` in
|
||||
# lockstep.
|
||||
name = "the forge's behindGateway default is true regardless of the central toggle";
|
||||
ok =
|
||||
bare.services.hyperhive.deploy.forgejo.behindGateway == true
|
||||
&& centralToggleOff.services.hyperhive.deploy.forgejo.behindGateway == true;
|
||||
}
|
||||
{
|
||||
# Downstream of the one above — publicUrl reads `behindGateway`, so it
|
||||
# tracked the central toggle transitively as well as directly. The domain
|
||||
# is the stub's swarm domain, which both fixtures share.
|
||||
name = "the forge's publicUrl default follows behindGateway alone, not the central toggle";
|
||||
ok =
|
||||
bare.services.hyperhive.swarm.forge.publicUrl == "https://forge.t.local"
|
||||
&& centralToggleOff.services.hyperhive.swarm.forge.publicUrl == "https://forge.t.local";
|
||||
}
|
||||
{
|
||||
# And that it still tracks `behindGateway` at all: without this arm the
|
||||
# case above passes just as well for a default hardcoded to the URL.
|
||||
name = "the forge's publicUrl default is still null with behindGateway off";
|
||||
ok =
|
||||
(hive { deploy.forgejo.behindGateway = false; }).services.hyperhive.swarm.forge.publicUrl == null;
|
||||
}
|
||||
{
|
||||
# The controller's token path defaulted to forge's delivery path only on
|
||||
# a host with the central toggle on, and to `null` otherwise. Forge
|
||||
# deploys unconditionally, so the path is now unconditional too.
|
||||
name = "the swarm controller's forgeTokenFile defaults to forge's delivery path regardless of the central toggle";
|
||||
ok =
|
||||
let
|
||||
forgePath = "/var/lib/hyperhive-forge/swarm-controller.token";
|
||||
in
|
||||
bare.services.hyperhive.deploy.swarm-controller.forgeTokenFile == forgePath
|
||||
&& centralToggleOff.services.hyperhive.deploy.swarm-controller.forgeTokenFile == forgePath;
|
||||
}
|
||||
{
|
||||
# `ctl` is in no deny list — it is reserved *because it is the subject a
|
||||
# cert-auth role accepts*, which is a value an operator sets, so a
|
||||
|
|
|
|||
Loading…
Reference in a new issue