Harden Elasticsearch tests against container startup flakes - #1445
Merged
Conversation
Replace Squadron's wait-for-green NEST health check with Testcontainers HTTP readiness, pin ES 7.17.29, and give the single-node container mmap-safe / no-geoip settings. Use a unique index per test and refresh before search instead of a fixed sleep. Co-authored-by: Daniel Gerlag <danielgerlag@users.noreply.github.com>
danielgerlag
marked this pull request as ready for review
September 7, 2026 22:55
This was referenced Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the change
Elasticsearch-Testshas been failing on master and open PRs (including #1443 / #1444) while every other provider job stays green. The failure is not an assertion flake in the indexer: all 7 tests die inElasticsearchDockerSetup.InitializeAsyncwith:Squadron starts
docker.elastic.co/elasticsearch/elasticsearch:7.17.29and then polls cluster health green through NEST. The mapped port never accepts connections within the 5-minute timeout (single-node bootstrap / mmap / geoip download / NEST product-check during startup). Last time this job was green on this repo was around October 2025; recent master runs fail the same way every time.Describe your implementation or design
Test-only hardening. No production Elasticsearch indexer behavior change.
ContainerBuilder(same approach as Azure/Oracle tests).node.store.allow_mmap=false, 512MB heap.200on/_cluster/health(yellow is fine) instead of NESTwait_for_status=green.Thread.Sleep(1000).vm.max_map_countin the Elasticsearch CI job.Tests
Existing
SearchIndexTests(7 facts) still cover search/filter. They now prove documents are searchable after an explicit refresh on an isolated index.This environment has no Docker daemon, so the tests were compiled (
net8.0) but not executed here. CIElasticsearch-Testsis the real verification.Breaking change
No.
Additional context
Failing test names (all same fixture timeout):
should_search_on_referenceshould_search_on_custom_datashould_filter_on_custom_datashould_filter_on_alt_custom_data_with_conflicting_namesshould_filter_on_referenceshould_filter_on_statusshould_filter_on_date_rangeThe refresh-race / shared-index hypothesis was not the current CI failure. Unique indexes + refresh are still included so those races cannot return once the container starts.