Watch
0
0
Fork
You've already forked hyperhive
0

keep the dashboard's probe out of the stub's forge requests

The identity-provider stand-in recorded Grafana's datasource-proxy probe with
the same forge_token_ok field as a forge request, so the poller's subtest,
which takes every record with that field for a forge request, counted three
probes and asserted that they carried the forge token.
This commit is contained in:
atlas 2026-11-28 03:06:33 +01:00
commit d007dfd7dc

View file

@ -245,11 +245,22 @@ let
def do_GET(self): def do_GET(self):
path = self.path.split("?")[0] path = self.path.split("?")[0]
# Grafana's datasource proxy sends a header whose value the test
# checks by digest. The record has no `forge_token_ok`, which the
# poller's subtest reads as the mark of a forge request.
if path == "/legacy-probe":
header = self.headers.get("X-Legacy")
record({
"host": self.headers.get("Host"),
"path": path,
"legacy_header_sha256": hashlib.sha256(header.encode()).hexdigest() if header else None,
})
self.send_error(404)
return
record({ record({
"host": self.headers.get("Host"), "host": self.headers.get("Host"),
"path": path, "path": path,
"forge_token_ok": self.headers.get("Authorization") == "token ${forgeToken}", "forge_token_ok": self.headers.get("Authorization") == "token ${forgeToken}",
"legacy_header_sha256": hashlib.sha256(self.headers["X-Legacy"].encode()).hexdigest() if self.headers.get("X-Legacy") else None,
}) })
if path.endswith("/repos/search"): if path.endswith("/repos/search"):
self.reply({"ok": True, "data": [{"full_name": "o/r", "has_actions": True, "archived": False, "mirror": False}]}) self.reply({"ok": True, "data": [{"full_name": "o/r", "has_actions": True, "archived": False, "mirror": False}]})