From 6982c253c09a45b3c777b70ad7e54178b0466575 Mon Sep 17 00:00:00 2001 From: Joao Morais Date: Fri, 21 Aug 2026 18:15:48 -0300 Subject: [PATCH] Fix the number of requests in repeated exec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `expectRouteStatusCodeRepeatedExec` treated `times` as a deadline in seconds, not a request count. The loop ran curl back-to-back for `times` seconds with no delay between requests — a tight loop. So callers actually fired an unbounded, load-dependent number of requests in 100 seconds - far more than 100 reqs, and hammering the router unnecessarily fast. Fix: * Replaced the time-based loop with a counter that increments once per iteration, so the loop runs exactly `times` times - matching what every caller's variable name and comments already implied. * Added `sleep 0.5` between iterations so requests are paced instead of fired in a tight loop. Net effect: times now means what it says (number of requests), and the requests are spaced out rather than bursted. https://redhat.atlassian.net/browse/OCPBUGS-112662 --- test/extended/router/scoped.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/extended/router/scoped.go b/test/extended/router/scoped.go index 3ab50fb9a61f..5331db5f063a 100644 --- a/test/extended/router/scoped.go +++ b/test/extended/router/scoped.go @@ -290,8 +290,8 @@ func expectRouteStatusCodeRepeatedExec(ns, execPodName, url, host string, status cmd := fmt.Sprintf(` set -e - STOP=$(($(date '+%%s') + %d)) - while [ $(date '+%%s') -lt $STOP ]; do + cnt=0 + while [ $cnt -lt %d ]; do rc=0 code=$( curl %s -s -m 5 -o /dev/null -w '%%{http_code}\n' --header 'Host: %s' %q ) || rc=$? if [[ "${rc:-0}" -eq 0 ]]; then @@ -302,6 +302,8 @@ func expectRouteStatusCodeRepeatedExec(ns, execPodName, url, host string, status else echo "error ${rc}" 1>&2 fi + sleep 0.5 + cnt=$((cnt+1)) done `, times, args, host, url, statusCode) output, err := e2eoutput.RunHostCmd(ns, execPodName, cmd)