fix: redact kafka smoke payload output

This commit is contained in:
Codex
2026-06-28 09:39:44 +00:00
parent 2a180039d9
commit 62630dcee6
+7 -2
View File
@@ -869,7 +869,7 @@ pod="$(kubectl -n ${target.namespace} get pod -l strimzi.io/cluster=${kafka.clus
payload="unidesk-kafka-smoke-${target.id}-$(date +%s)-$$" payload="unidesk-kafka-smoke-${target.id}-$(date +%s)-$$"
printf '%s' "$payload" >"$tmp/payload.txt" printf '%s' "$payload" >"$tmp/payload.txt"
if [ -n "$pod" ]; then if [ -n "$pod" ]; then
printf '%s\\n' "$payload" | kubectl -n ${target.namespace} exec -i "$pod" -- bin/kafka-console-producer.sh --bootstrap-server ${kafka.cluster.name}-kafka-bootstrap:${kafka.cluster.listeners.plain.port} --topic ${topic} --producer-property acks=all >"$tmp/produce.out" 2>"$tmp/produce.err" printf '%s\\n' "$payload" | kubectl -n ${target.namespace} exec -i "$pod" -- bin/kafka-console-producer.sh --bootstrap-server ${kafka.cluster.name}-kafka-bootstrap:${kafka.cluster.listeners.plain.port} --topic ${topic} --command-property acks=all >"$tmp/produce.out" 2>"$tmp/produce.err"
produce_rc=$? produce_rc=$?
if [ "$produce_rc" -eq 0 ]; then if [ "$produce_rc" -eq 0 ]; then
timeout ${kafka.validation.timeoutSeconds} kubectl -n ${target.namespace} exec "$pod" -- bin/kafka-console-consumer.sh --bootstrap-server ${kafka.cluster.name}-kafka-bootstrap:${kafka.cluster.listeners.plain.port} --topic ${topic} --from-beginning --timeout-ms ${kafka.validation.timeoutSeconds * 1000} >"$tmp/consume.raw" 2>"$tmp/consume.err" || true timeout ${kafka.validation.timeoutSeconds} kubectl -n ${target.namespace} exec "$pod" -- bin/kafka-console-consumer.sh --bootstrap-server ${kafka.cluster.name}-kafka-bootstrap:${kafka.cluster.listeners.plain.port} --topic ${topic} --from-beginning --timeout-ms ${kafka.validation.timeoutSeconds * 1000} >"$tmp/consume.raw" 2>"$tmp/consume.err" || true
@@ -903,11 +903,16 @@ payload_obj = {
"pod": pod or None, "pod": pod or None,
"message": { "message": {
"sha256": hashlib.sha256(payload.encode()).hexdigest(), "sha256": hashlib.sha256(payload.encode()).hexdigest(),
"matched": consume_rc == 0,
"valuesPrinted": False "valuesPrinted": False
}, },
"steps": { "steps": {
"produce": {"exitCode": produce_rc, "stdoutTail": text("produce.out"), "stderrTail": text("produce.err")}, "produce": {"exitCode": produce_rc, "stdoutTail": text("produce.out"), "stderrTail": text("produce.err")},
"consume": {"exitCode": consume_rc, "stdoutTail": text("consume.out"), "stderrTail": text("consume.err")}, "consume": {
"exitCode": consume_rc,
"stdoutTail": "payload matched; stdout redacted" if consume_rc == 0 else "payload not found; stdout redacted",
"stderrTail": text("consume.err"),
},
}, },
"valuesPrinted": False, "valuesPrinted": False,
} }