File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2339,35 +2339,24 @@ docker_e2e_docker_cmd() {
23392339
23402340sleep() {
23412341 SECONDS=$((SECONDS + \${1%%.*}))
2342- command sleep 0.01
2342+ }
2343+
2344+ kill_checks=0
2345+ kill() {
2346+ if [[ "\${1:-}" == "-0" && "\${2:-}" == "sampled-docker-pid" ]]; then
2347+ kill_checks=$((kill_checks + 1))
2348+ [[ "$kill_checks" -le 6 ]]
2349+ return
2350+ fi
2351+ command kill "$@"
23432352}
23442353
23452354stats_log="$TMPDIR/stats.log"
23462355run_log="$TMPDIR/run.log"
23472356sampler_log="$TMPDIR/sampler.log"
23482357printf "container output\\n" >"$run_log"
23492358
2350- (
2351- command sleep 30
2352- ) &
2353- docker_pid="$!"
2354-
2355- docker_e2e_sample_stats_until_exit demo "$docker_pid" "$stats_log" "$run_log" "Docker stats" 08 >"$sampler_log" 2>&1 &
2356- sampler_pid="$!"
2357-
2358- for _ in {1..200}; do
2359- if grep -q "Docker stats still running (8s elapsed," "$sampler_log"; then
2360- break
2361- fi
2362- if ! kill -0 "$sampler_pid" 2>/dev/null; then
2363- break
2364- fi
2365- command sleep 0.01
2366- done
2367-
2368- kill "$docker_pid" 2>/dev/null || true
2369- wait "$docker_pid" 2>/dev/null || true
2370- wait "$sampler_pid"
2359+ docker_e2e_sample_stats_until_exit demo sampled-docker-pid "$stats_log" "$run_log" "Docker stats" 08 >"$sampler_log" 2>&1
23712360output="$(cat "$sampler_log")"
23722361
23732362[[ "$output" = *"Docker stats still running (8s elapsed,"* ]]
You can’t perform that action at this time.
0 commit comments