chore: refactoring (split)

This commit is contained in:
FUFSoB committed 2026-07-11 10:54:37 +05:00
1 parent 835651c460
commit e54c9463dd
84 files changed
+9149 -7244

No files matched your search

+81
View File
@@ -0,0 +1,81 @@
{
evalProxySuite,
mkBadFixtureRaw,
mkFailingAssertions,
}:
let
proxyWithSubscriptions =
subscriptions:
{
system.stateVersion = "26.05";
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
singBox.enable = true;
inherit subscriptions;
};
};
};
subscriptionUrlFileFixture = evalProxySuite [
(proxyWithSubscriptions [
{
tag = "private";
urlFile = "/run/secrets/sub-url";
}
])
];
in
{
assertions =
(mkFailingAssertions mkBadFixtureRaw [
# Tags are cache keys and tag prefixes, so duplicates are invalid.
[
(proxyWithSubscriptions [
{
tag = "dup";
url = "https://example.com/sub/one";
}
{
tag = "dup";
url = "https://example.com/sub/two";
}
])
]
# Tags must be safe for generated names.
[
(proxyWithSubscriptions [
{
tag = "bad/tag";
url = "https://example.com/sub/token";
}
])
]
# A subscription source must be either url or urlFile, not both.
[
(proxyWithSubscriptions [
{
tag = "bad";
url = "https://example.com/sub/token";
urlFile = "/run/secrets/sub-url";
}
])
]
# A subscription with no source is invalid.
[
(proxyWithSubscriptions [ { tag = "bad"; } ])
]
])
++ [
# urlFile form is accepted.
(
assert subscriptionUrlFileFixture.config.services.proxy-suite.proxy.subscriptions != [ ];
true
)
];
}