You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cc731e3
Browse filesBrowse the repository at this point in the historyBrowse files
test(e2e): keep redis-tls failures legible under the op ceiling
The CA-projection step caps each kubectl at 30s, but more capped reads
run than its 5m op can cover, so a degraded apiserver could spend the
ceiling and leave nothing but "signal: killed". The reads now share a
step budget held under the op, and a read that hits its bound or finds
the budget spent says which read it was.
Two exec checks reported the 15s redis-cli cap for any failure, sending
a reader after a slow redis when the exec was refused or the container
was missing. They now report the exit status and what the exec
printed. The step also runs under bash with pipefail: under dash a
failed Secret read took base64's zero status and surfaced as a wrong
source name. The private-key check reads the projection already
fetched, since a second read that failed made it pass.
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>
[ -z"$rt_bare" ] || { echo"kubectl calls in $REDIS_STEP that bypass the clamped k():">&2;printf'%s\n'"$rt_bare">&2;exit 1; }
248
+
}
249
+
250
+
@test "the redis-tls projection script passes against a healthy stub" {
251
+
# The positive control for the two failure tests below: without it, a
252
+
# stub that broke the script somewhere else would make them pass.
253
+
rt_dir=$(mktemp -d)
254
+
write_redis_stubs "$rt_dir"
255
+
rt_out=$(run_redis_step "$rt_dir")
256
+
case"$rt_out"in*"
257
+
rc=0") ;; *) printf'%s\n'"$rt_out">&2;echo"the step failed against a healthy stub">&2;exit 1 ;; esac
258
+
rm -rf "$rt_dir"
259
+
}
260
+
261
+
@test "a failed replication exec reports its own error, not the 15s cap" {
262
+
rt_dir=$(mktemp -d)
263
+
write_redis_stubs "$rt_dir"
264
+
rt_out=$(STUB_FAIL='*exec rfr-redis-secure-1 -c redis -- sh -c*' STUB_RC=1 \
265
+
STUB_ERR='Error from server (Forbidden): pods "rfr-redis-secure-1" is forbidden' run_redis_step "$rt_dir")
266
+
case"$rt_out"in*"
267
+
rc=0") printf'%s\n'"$rt_out">&2;echo"the step passed with a forbidden exec">&2;exit 1 ;; esac
268
+
case"$rt_out"in*"15s cap"*) printf'%s\n'"$rt_out">&2;echo"a forbidden exec was reported as the 15s cap firing">&2;exit 1 ;; esac
269
+
case"$rt_out"in*"rfr-redis-secure-1"*"exit 1"*"Forbidden"*) ;; *) printf'%s\n'"$rt_out">&2;echo"the message does not carry the exit status and what the exec printed">&2;exit 1 ;; esac
270
+
rm -rf "$rt_dir"
271
+
}
272
+
273
+
@test "a failed sentinel exec reports its own error, not the 15s cap" {
rc=0") printf'%s\n'"$rt_out">&2;echo"the step passed with a failed sentinel exec">&2;exit 1 ;; esac
280
+
case"$rt_out"in*"15s cap"*) printf'%s\n'"$rt_out">&2;echo"a refused sentinel command was reported as the 15s cap firing">&2;exit 1 ;; esac
281
+
case"$rt_out"in*"command terminated with exit code 1"*"rfs-redis-secure-0 failed (exit 1): NOAUTH Authentication required."*) ;; *) printf'%s\n'"$rt_out">&2;echo"the output does not carry what the exec wrote to both streams and its exit status">&2;exit 1 ;; esac
282
+
rm -rf "$rt_dir"
283
+
}
284
+
285
+
@test "a failed Secret read is not reported as a wrong source name" {
286
+
# base64 -d exits 0 on empty input, so without pipefail the pipeline takes
287
+
# its status and the emptiness check below names the wrong cause.
STUB_ERR='Error from server (ServiceUnavailable): the server is currently unable to handle the request' run_redis_step "$rt_dir")
308
+
case"$rt_out"in*"
309
+
rc=0") printf'%s\n'"$rt_out">&2;echo"the step passed with key material in the projection">&2;exit 1 ;; esac
310
+
case"$rt_out"in*"projection carries PEM private key material"*) ;; *) printf'%s\n'"$rt_out">&2;echo"the step did not fail on the key material">&2;exit 1 ;; esac
311
+
rm -rf "$rt_dir"
312
+
}
313
+
314
+
@test "a read that finds the step budget spent does not run and says so" {
315
+
rt_dir=$(mktemp -d)
316
+
write_redis_stubs "$rt_dir"
317
+
rt_out=$(RS_BUDGET=0 run_redis_step "$rt_dir")
318
+
case"$rt_out"in*"
319
+
rc=0") printf'%s\n'"$rt_out">&2;echo"the step passed with its budget spent before the first read">&2;exit 1 ;; esac
320
+
case"$rt_out"in*"step budget is spent, so this read did not run: -n tenant-test get secret redis-secure.tenant-ca"*) ;; *) printf'%s\n'"$rt_out">&2;echo"the first read did not report the spent budget">&2;exit 1 ;; esac
321
+
rm -rf "$rt_dir"
322
+
}
323
+
324
+
@test "a read is clamped to what the step budget has left and names itself" {
325
+
# A 2s budget against a read that would hang for 20s: the clamp has to
326
+
# end the read at the budget, not at the 30s per-read cap.
rc=0") printf'%s\n'"$rt_out">&2;echo"the step passed with a hung read">&2;exit 1 ;; esac
334
+
case"$rt_out"in*"ran into its "[12]"s bound: -n tenant-test get secret redis-secure.tenant-ca"*) ;; *) printf'%s\n'"$rt_out">&2;echo"the hung read did not name itself at the budget's bound">&2;exit 1 ;; esac
335
+
[ "$rt_took"-lt 15 ] || { echo"the step took ${rt_took}s against a 2s budget; the read was not clamped">&2;exit 1; }
0 commit comments