Skip to content

Fix flaky BATS integration tests for extraction, and JMX startup#4303

Open
janhoy wants to merge 1 commit intoapache:mainfrom
janhoy:fix/bats-integration-test-flakiness
Open

Fix flaky BATS integration tests for extraction, and JMX startup#4303
janhoy wants to merge 1 commit intoapache:mainfrom
janhoy:fix/bats-integration-test-flakiness

Conversation

@janhoy
Copy link
Copy Markdown
Contributor

@janhoy janhoy commented Apr 20, 2026

  • 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_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.

See test history in develocity

- 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 <noreply@anthropic.com>
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome. I guess in the past it fired up fast enough most of the time that we didn't need the wait for?

Copy link
Copy Markdown
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants