require both attic options, follow attic's cache-name rule, read the token from a file
This commit is contained in:
parent
0849afec80
commit
bd214b9f3e
1 changed files with 156 additions and 41 deletions
|
|
@ -39,6 +39,21 @@ let
|
|||
m:
|
||||
lib.any (a: !a.assertion && lib.hasInfix "deploy.builder.enable requires" a.message) m.assertions;
|
||||
|
||||
# The one fixture that fires the cache assertion: a domain with no cache name.
|
||||
halfCache = hive {
|
||||
deploy.bao.enable = true;
|
||||
deploy.builder.enable = true;
|
||||
swarm.attic.domain = "cache.example.org";
|
||||
};
|
||||
refusedHalfCache =
|
||||
m:
|
||||
lib.any (
|
||||
a:
|
||||
!a.assertion && lib.hasInfix "swarm.attic.domain and services.hyperhive.swarm.attic.cache" a.message
|
||||
) m.assertions;
|
||||
# Only the option is read, so the host around it is never evaluated.
|
||||
cacheNamed = name: (hive { swarm.attic.cache = name; }).services.hyperhive.swarm.attic.cache;
|
||||
|
||||
natsHere = shared.natsQueueOnly;
|
||||
|
||||
autheliaHere = hive {
|
||||
|
|
@ -139,6 +154,30 @@ let
|
|||
&& !(withoutCache.environment ? SWARM_BUILDER_ATTIC_DOMAIN)
|
||||
&& !(withoutCache.environment ? SWARM_BUILDER_ATTIC_CACHE);
|
||||
}
|
||||
{
|
||||
# A domain with no cache name would crash-loop the builder at start, so
|
||||
# evaluation refuses it. `withBuilder`, with both set, is the control: the
|
||||
# same assertion list holds the entry and it passes.
|
||||
name = "the builder refuses a cache domain without a cache name";
|
||||
ok =
|
||||
refusedHalfCache halfCache
|
||||
&& !(refusedHalfCache withBuilder)
|
||||
&& lib.any (a: lib.hasInfix "swarm.attic.domain and" a.message) withBuilder.assertions;
|
||||
}
|
||||
{
|
||||
# attic refuses a cache name outside its rule, which would fail every push.
|
||||
# `grid` is the control that the lookup reads a name.
|
||||
name = "the cache name must follow attic's rule";
|
||||
ok =
|
||||
cacheNamed "grid" == "grid"
|
||||
&& cacheNamed "A-b_c+d" == "A-b_c+d"
|
||||
&& lib.all (n: !(builtins.tryEval (cacheNamed n)).success) [
|
||||
"grid.v2"
|
||||
"-grid"
|
||||
""
|
||||
(lib.concatStrings (lib.genList (_: "a") 51))
|
||||
];
|
||||
}
|
||||
{
|
||||
# The minting unit goes inactive after each run, so a start that pulls it
|
||||
# runs it again and mints a leaf that is missing; an active
|
||||
|
|
|
|||
Loading…
Reference in a new issue