Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ci-metrics: move the settings and pass logic out of main and test it

main read the environment inline and held the per-repo pass, the
certificate gauges and the verdict, so none of it could run in a test.
Each is now a function with its inputs as arguments:

- Env::read takes a lookup closure in place of std::env (same read
  order), var names a missing setting by its full variable.
- finish, skip_counts, wanted_repo, walk_done, trimmed and cert_gauges
  hold the branches that were inline.
- A pass talks to the forge, the identity provider and the collector
  through a Remote trait. Live is the daemon's HTTP implementation, and
  the tests' stand-in answers from memory, so no test opens a socket.
- post_request builds the collector request and refused the refusal
  text, so both are tested without a connection.

x509-cert becomes a dev-dependency (the workspace already pins it) for
the test certificate. Behaviour is the same.

Refs #6811
This commit is contained in:
maia 2026-11-23 22:21:39 +01:00 • committed by mara
commit e88de09d72
3 changed files with 1022 additions and 119 deletions

1
Cargo.lock generated
View file

@ -5476,6 +5476,7 @@ dependencies = [
"tokio",
"tracing",
"url",
"x509-cert",
]
[[package]]

View file

@ -32,6 +32,8 @@ url.workspace = true
[dev-dependencies]
# A scratch state directory for the cursor tests.
tempfile = "3"
# Builds the client certificate the cert-gauge tests read.
x509-cert.workspace = true
[lints]
workspace = true

File diff suppressed because it is too large Load diff