k8s-services: the seeded log record is found by a word of its message, and a stuck seed fails its unit
This commit is contained in:
parent
71b2e9310c
commit
a4e44645a0
1 changed files with 11 additions and 7 deletions
|
|
@ -373,6 +373,9 @@ pkgs.testers.runNixOSTest {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
User = legacyUser;
|
User = legacyUser;
|
||||||
|
# k3s waits for this unit, so a record that never shows must fail it
|
||||||
|
# and not hold the boot.
|
||||||
|
TimeoutStartSec = 120;
|
||||||
UMask = "0007";
|
UMask = "0007";
|
||||||
ExecStartPre = "+${pkgs.writeShellScript "victorialogs-legacy-dir" ''
|
ExecStartPre = "+${pkgs.writeShellScript "victorialogs-legacy-dir" ''
|
||||||
mkdir -p ${vlDir}
|
mkdir -p ${vlDir}
|
||||||
|
|
@ -388,7 +391,8 @@ pkgs.testers.runNixOSTest {
|
||||||
curl -sf --data-binary \
|
curl -sf --data-binary \
|
||||||
"{\"_msg\":\"written before the switch\",\"app\":\"legacy\",\"_time\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" \
|
"{\"_msg\":\"written before the switch\",\"app\":\"legacy\",\"_time\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" \
|
||||||
'http://127.0.0.1:${toString legacyPort}/insert/jsonline?_stream_fields=app'
|
'http://127.0.0.1:${toString legacyPort}/insert/jsonline?_stream_fields=app'
|
||||||
until curl -s --data-urlencode 'query=legacy' http://127.0.0.1:${toString legacyPort}/select/logsql/query \
|
# A bare word matches the message field, so the query names a word of it.
|
||||||
|
until curl -s --data-urlencode 'query=switch' http://127.0.0.1:${toString legacyPort}/select/logsql/query \
|
||||||
| grep -q 'written before the switch'; do sleep 1; done
|
| grep -q 'written before the switch'; do sleep 1; done
|
||||||
kill -TERM "$pid"
|
kill -TERM "$pid"
|
||||||
wait "$pid" || true
|
wait "$pid" || true
|
||||||
|
|
@ -854,15 +858,15 @@ pkgs.testers.runNixOSTest {
|
||||||
AGENT_TOKEN = f"swarm-agent.{AGENT}.{AGENT_SECRETS[AGENT]}"
|
AGENT_TOKEN = f"swarm-agent.{AGENT}.{AGENT_SECRETS[AGENT]}"
|
||||||
|
|
||||||
with subtest("an agent's bearer reads the record written before the switch through the gateway, and the other bearers are granted or refused as the store says"):
|
with subtest("an agent's bearer reads the record written before the switch through the gateway, and the other bearers are granted or refused as the store says"):
|
||||||
wait_for_record(AGENT_TOKEN, "legacy", "written before the switch")
|
wait_for_record(AGENT_TOKEN, "switch", "written before the switch")
|
||||||
# Each refusal has the answer above as its control: the same request with
|
# Each refusal has the answer above as its control: the same request with
|
||||||
# a bearer the store grants.
|
# a bearer the store grants.
|
||||||
assert vl_query(f"swarm-agent.{OTHER_AGENT}.{AGENT_SECRETS[OTHER_AGENT]}", "legacy")[0] == 403
|
assert vl_query(f"swarm-agent.{OTHER_AGENT}.{AGENT_SECRETS[OTHER_AGENT]}", "switch")[0] == 403
|
||||||
assert vl_query(f"swarm-agent.{AGENT}.{'0' * 32}", "legacy")[0] == 401
|
assert vl_query(f"swarm-agent.{AGENT}.{'0' * 32}", "switch")[0] == 401
|
||||||
# Grafana's bearer goes to the second responder of the same pod.
|
# Grafana's bearer goes to the second responder of the same pod.
|
||||||
status, body = vl_query(GRAFANA_BEARER, "legacy")
|
status, body = vl_query(GRAFANA_BEARER, "switch")
|
||||||
assert status == 200 and "written before the switch" in body, (status, body)
|
assert status == 200 and "written before the switch" in body, (status, body)
|
||||||
assert vl_query("0" * 64, "legacy")[0] == 401
|
assert vl_query("0" * 64, "switch")[0] == 401
|
||||||
|
|
||||||
with subtest("a record posted to the ingest route and the store's own metrics come through the gateway, and a restarted pod still holds both records"):
|
with subtest("a record posted to the ingest route and the store's own metrics come through the gateway, and a restarted pod still holds both records"):
|
||||||
import base64
|
import base64
|
||||||
|
|
@ -892,7 +896,7 @@ pkgs.testers.runNixOSTest {
|
||||||
assert status == 200 and "vl_" in body, (status, body[:200])
|
assert status == 200 and "vl_" in body, (status, body[:200])
|
||||||
kube(machine, f"delete pod {vl_pod} --wait=true", timeout=120)
|
kube(machine, f"delete pod {vl_pod} --wait=true", timeout=120)
|
||||||
vl_pod = wait_pod_ready(VL)
|
vl_pod = wait_pod_ready(VL)
|
||||||
wait_for_record(AGENT_TOKEN, "legacy", "written before the switch")
|
wait_for_record(AGENT_TOKEN, "switch", "written before the switch")
|
||||||
wait_for_record(AGENT_TOKEN, "gateway", "written through the gateway")
|
wait_for_record(AGENT_TOKEN, "gateway", "written through the gateway")
|
||||||
|
|
||||||
with subtest("only the node reaches the log store's pods, and the responders' pod reaches the store's pod listener and no other port of the host"):
|
with subtest("only the node reaches the log store's pods, and the responders' pod reaches the store's pod listener and no other port of the host"):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue