Watch
0
0
Fork
You've already forked hyperhive
0

stop the dashboard subtests overwriting the driver's pod()

The subtest that reads the Grafana pod's spec assigned it to `pod`, which is
the name of lib/k3s.py's pod(); the next wait_pod() call, after the pod delete,
died with "'dict' object is not callable".
This commit is contained in:
atlas 2026-11-28 01:41:17 +01:00
commit c42935bd1d

View file

@ -1779,16 +1779,16 @@ pkgs.testers.runNixOSTest {
grafana_pod = wait_pod_ready(GRAFANA, timeout=900) grafana_pod = wait_pod_ready(GRAFANA, timeout=900)
with subtest("the dashboard's init container fetched its secrets, its sidecar runs, and the pod mounts no store's credential"): with subtest("the dashboard's init container fetched its secrets, its sidecar runs, and the pod mounts no store's credential"):
pod = json.loads(kube(machine, f"get pod {grafana_pod} -o json")) grafana_spec = json.loads(kube(machine, f"get pod {grafana_pod} -o json"))
init = pod["status"]["initContainerStatuses"] init = grafana_spec["status"]["initContainerStatuses"]
assert [c["name"] for c in init] == ["fetch-secrets"] and init[0]["state"]["terminated"]["exitCode"] == 0, init assert [c["name"] for c in init] == ["fetch-secrets"] and init[0]["state"]["terminated"]["exitCode"] == 0, init
running = {c["name"]: c for c in pod["status"]["containerStatuses"]} running = {c["name"]: c for c in grafana_spec["status"]["containerStatuses"]}
assert set(running) == {GRAFANA, "controller-token"}, running.keys() assert set(running) == {GRAFANA, "controller-token"}, running.keys()
assert all(c["ready"] and "running" in c["state"] for c in running.values()), running assert all(c["ready"] and "running" in c["state"] for c in running.values()), running
# The pod mounts the one Secret of its own listener's credential and # The pod mounts the one Secret of its own listener's credential and
# none of the two stores', which it reaches through the gateway with # none of the two stores', which it reaches through the gateway with
# its bearer; the values it fetched are in no container's log. # its bearer; the values it fetched are in no container's log.
secrets = {v["secret"]["secretName"] for v in pod["spec"]["volumes"] if "secret" in v} secrets = {v["secret"]["secretName"] for v in grafana_spec["spec"]["volumes"] if "secret" in v}
assert secrets <= {"swarm-grafana-credentials"}, secrets assert secrets <= {"swarm-grafana-credentials"}, secrets
stored = as_root("bao kv get -mount=secret -field=value swarm/services/grafana/store-auth").strip() stored = as_root("bao kv get -mount=secret -field=value swarm/services/grafana/store-auth").strip()
for name in (GRAFANA, "controller-token"): for name in (GRAFANA, "controller-token"):