Merge remote-tracking branch 'origin/topic/etyp/centos-missing-file-test-fail'

* origin/topic/etyp/centos-missing-file-test-fail:
  Fix flaky `missing-file-initially` test
This commit is contained in:
Arne Welzel 2024-10-04 19:31:36 +02:00
commit c826118385
3 changed files with 23 additions and 5 deletions

14
CHANGES
View file

@ -1,3 +1,17 @@
7.1.0-dev.381 | 2024-10-04 19:31:36 +0200
* GH-3949: Fix flaky `missing-file-initially` test (Evan Typanski, Corelight)
That test got flaky probably from #3949 on centosstream9 CI. You can
replicate that behavior by increasing the sleep time when waiting for
the file such that the test will attempt to read the missing file again.
Since the one second wait for file is glacially slow for this, speeding
it up should mean that the file gets created sooner and so the test
won't try to open the file again. But, it's always still technically
possible, since the test will wait for 10 seconds and the heartbeat
seems to be 1 second. At least if that happens, it's probably a bug or
massive slowdown of some kind.
7.1.0-dev.379 | 2024-10-04 13:34:31 +0200 7.1.0-dev.379 | 2024-10-04 13:34:31 +0200
* Add missing newline in `spicyz` usage message (Benjamin Bannier, Corelight) * Add missing newline in `spicyz` usage message (Benjamin Bannier, Corelight)

View file

@ -1 +1 @@
7.1.0-dev.379 7.1.0-dev.381

View file

@ -7,17 +7,21 @@ if [[ $# -ne 2 ]]; then
exit 1 exit 1
fi fi
SLEEP_INTERVAL=0.1
SLEEP_INTERVAL_MS=100
wait_file=$1 wait_file=$1
max_wait=$2 max_wait=$2
wait_count=0 # Avoid floating point arithmetic by using milliseconds
wait_countdown=$((${max_wait}000 / SLEEP_INTERVAL_MS))
while [[ ! -e $wait_file ]]; do while [[ ! -e $wait_file ]]; do
let "wait_count += 1" wait_countdown=$((wait_countdown - 1))
if [[ $wait_count -ge $max_wait ]]; then if [[ $wait_countdown -le 0 ]]; then
echo >&2 "error: file '$wait_file' does not exist after $max_wait seconds" echo >&2 "error: file '$wait_file' does not exist after $max_wait seconds"
exit 1 exit 1
fi fi
sleep 1 sleep $SLEEP_INTERVAL
done done