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 4c7ef0d
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]>
@test "the gateway listener-set op outlasts the waits inside it" {
68
162
gw_op=$(op_lines "$GATEWAY_SUITE""$GATEWAY_STEP")
69
163
[ -n"$gw_op" ] || { echo"no script op found in step $GATEWAY_STEP of $GATEWAY_SUITE">&2;exit 1; }
@@ -106,3 +200,115 @@ op_content() {
106
200
')
107
201
[ "$gw_order"= ok ] || { echo"the rparent delete in $GATEWAY_STEP does not sit directly under a successful rchild delete (got '${gw_order}')">&2;exit 1; }
108
202
}
203
+
204
+
@test "the redis-tls projection op outlasts the step budget its reads are clamped to" {
205
+
rt_op=$(op_lines "$REDIS_SUITE""$REDIS_STEP")
206
+
[ -n"$rt_op" ] || { echo"no script op found in step $REDIS_STEP of $REDIS_SUITE">&2;exit 1; }
207
+
rt_timeout=$(op_timeout_seconds "$rt_op")
208
+
case"$rt_timeout"in''|*[!0-9]*) echo"the $REDIS_STEP op states no timeout in m or s (got '${rt_timeout}')">&2;exit 1 ;; esac
209
+
rt_body=$(op_content "$rt_op")
210
+
rt_budget=$(printf '%s\n'"$rt_body"| sed -n 's/^step_budget=\([0-9][0-9]*\)$/\1/p')
211
+
[ -n"$rt_budget" ] || {
212
+
echo"$REDIS_STEP sets no step_budget, so nothing bounds the sum of its reads below the ${rt_timeout}s op">&2
213
+
echo"its kubectl call sites alone come to $(printf '%s\n'"$rt_body"| grep -cE '(^|[^[:alnum:]_])k -n ')">&2
[ -z"$rt_bare" ] || { echo"kubectl calls in $REDIS_STEP that bypass the clamped k():">&2;printf'%s\n'"$rt_bare">&2;exit 1; }
225
+
}
226
+
227
+
@test "the redis-tls projection script passes against a healthy stub" {
228
+
# The positive control for the two failure tests below: without it, a
229
+
# stub that broke the script somewhere else would make them pass.
230
+
rt_dir=$(mktemp -d)
231
+
write_redis_stubs "$rt_dir"
232
+
rt_out=$(run_redis_step "$rt_dir")
233
+
case"$rt_out"in*"
234
+
rc=0") ;; *) printf'%s\n'"$rt_out">&2;echo"the step failed against a healthy stub">&2;exit 1 ;; esac
235
+
rm -rf "$rt_dir"
236
+
}
237
+
238
+
@test "a failed replication exec reports its own error, not the 15s cap" {
239
+
rt_dir=$(mktemp -d)
240
+
write_redis_stubs "$rt_dir"
241
+
rt_out=$(STUB_FAIL='*exec rfr-redis-secure-1 -c redis -- sh -c*' STUB_RC=1 \
242
+
STUB_ERR='Error from server (Forbidden): pods "rfr-redis-secure-1" is forbidden' run_redis_step "$rt_dir")
243
+
case"$rt_out"in*"
244
+
rc=0") printf'%s\n'"$rt_out">&2;echo"the step passed with a forbidden exec">&2;exit 1 ;; esac
245
+
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
246
+
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
247
+
rm -rf "$rt_dir"
248
+
}
249
+
250
+
@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
257
+
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
258
+
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
259
+
rm -rf "$rt_dir"
260
+
}
261
+
262
+
@test "a failed Secret read is not reported as a wrong source name" {
263
+
# base64 -d exits 0 on empty input, so without pipefail the pipeline takes
264
+
# 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")
285
+
case"$rt_out"in*"
286
+
rc=0") printf'%s\n'"$rt_out">&2;echo"the step passed with key material in the projection">&2;exit 1 ;; esac
287
+
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
288
+
rm -rf "$rt_dir"
289
+
}
290
+
291
+
@test "a read that finds the step budget spent does not run and says so" {
292
+
rt_dir=$(mktemp -d)
293
+
write_redis_stubs "$rt_dir"
294
+
rt_out=$(RS_BUDGET=0 run_redis_step "$rt_dir")
295
+
case"$rt_out"in*"
296
+
rc=0") printf'%s\n'"$rt_out">&2;echo"the step passed with its budget spent before the first read">&2;exit 1 ;; esac
297
+
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
298
+
rm -rf "$rt_dir"
299
+
}
300
+
301
+
@test "a read is clamped to what the step budget has left and names itself" {
302
+
# A 2s budget against a read that would hang for 20s: the clamp has to
303
+
# 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
311
+
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
312
+
[ "$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