From eed52ab1c5e33e7ccbec69a7112c13e4f6b70714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B8ydahl?= Date: Tue, 21 Apr 2026 00:57:41 +0200 Subject: [PATCH] Fix flaky BATS integration tests for extraction, post, and JMX startup - test_extraction.bats: wait for Tika Docker container to be ready before tests run; apache/tika:3.2.3.0-full takes 30+ s to start inside the container and there was no readiness check. Falls back to DOCKER_UNAVAILABLE (skip) if Tika never becomes ready within 120 s. - test_post.bats: guard Solr availability with wait_for before creating the 'monitors_verbose' collection in the verbose-echo test, preventing IOException when Solr is temporarily unresponsive after preceding tests. - test_start_solr.bats: narrow SOLR-16976 assertion from 'Exception' to 'Exception in thread' so a benign ShutdownMonitor BindException (port-reuse race from prior test teardown) no longer causes a false failure. Co-Authored-By: Claude Sonnet 4.6 --- solr/packaging/test/test_extraction.bats | 8 +++++++- solr/packaging/test/test_start_solr.bats | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/solr/packaging/test/test_extraction.bats b/solr/packaging/test/test_extraction.bats index 12c4b72840ad..4b8e62ae59cc 100644 --- a/solr/packaging/test/test_extraction.bats +++ b/solr/packaging/test/test_extraction.bats @@ -41,7 +41,13 @@ setup_file() { if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then export TIKA_PORT=$((SOLR_PORT+5)) docker run --rm -p ${TIKA_PORT}:9998 --name bats_tika -d apache/tika:3.2.3.0-full >/dev/null 2>&1 || true - echo "Tika Server started on port ${TIKA_PORT}" >&3 + echo "Waiting for Tika Server to be ready on port ${TIKA_PORT}" >&3 + if ! wait_for 120 3 curl -s -f "http://localhost:${TIKA_PORT}/tika" -o /dev/null; then + export DOCKER_UNAVAILABLE=1 + echo "WARNING: Tika Server did not become ready in time; Tika-dependent tests will be bypassed." >&3 + else + echo "Tika Server is ready on port ${TIKA_PORT}" >&3 + fi else export DOCKER_UNAVAILABLE=1 echo "WARNING: Docker not available (CLI missing or daemon not running); Tika-dependent tests will be bypassed." >&3 diff --git a/solr/packaging/test/test_start_solr.bats b/solr/packaging/test/test_start_solr.bats index ef25ea32ee79..a24ceadd24c5 100644 --- a/solr/packaging/test/test_start_solr.bats +++ b/solr/packaging/test/test_start_solr.bats @@ -80,7 +80,7 @@ teardown() { solr assert --started http://localhost:${SOLR_PORT} --timeout 5000 run cat ${SOLR_LOGS_DIR}/solr-${SOLR_PORT}-console.log - refute_output --partial 'Exception' + refute_output --partial 'Exception in thread' } @test "deprecated system properties converted to modern properties" {