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:
parent
f8fb71253e
commit
c42935bd1d
1 changed files with 4 additions and 4 deletions
|
|
@ -1779,16 +1779,16 @@ pkgs.testers.runNixOSTest {
|
|||
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"):
|
||||
pod = json.loads(kube(machine, f"get pod {grafana_pod} -o json"))
|
||||
init = pod["status"]["initContainerStatuses"]
|
||||
grafana_spec = json.loads(kube(machine, f"get pod {grafana_pod} -o json"))
|
||||
init = grafana_spec["status"]["initContainerStatuses"]
|
||||
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 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
|
||||
# none of the two stores', which it reaches through the gateway with
|
||||
# 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
|
||||
stored = as_root("bao kv get -mount=secret -field=value swarm/services/grafana/store-auth").strip()
|
||||
for name in (GRAFANA, "controller-token"):
|
||||
|
|
|
|||
Loading…
Reference in a new issue