Skip to content

Conversation

@bowenlan-amzn
Copy link
Member

@bowenlan-amzn bowenlan-amzn commented Nov 17, 2025

Example failure: https://github.com/opensearch-project/index-management/actions/runs/19418611760/job/55551674679?pr=1455

The test was flaky because rollup job coroutines continued running after test cleanup, causing a race condition where the config index was recreated with incorrect dynamic mappings.

Root cause:

  • Tests create enabled rollups -> JobScheduler schedules them
  • RollupRunner.runJob() launches coroutines via launch {}
  • Test @After wipes indices
  • BUT coroutines are still running in background
  • Coroutines write metadata AFTER indices wiped
  • Index auto-creates with wrong dynamic mappings (long vs date)
  • Next test fails with mapping conflict on rollup_metadata.continuous.next_window_end_time

Related Issues

Resolves #90

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

The test was flaky because rollup job coroutines continued running after
test cleanup, causing a race condition where the config index was recreated
with incorrect dynamic mappings.

Root cause:
- Tests create enabled rollups -> JobScheduler schedules them
- RollupRunner.runJob() launches coroutines via launch {}
- Test @after wipes indices
- BUT coroutines are still running in background
- Coroutines write metadata AFTER indices wiped
- Index auto-creates with wrong dynamic mappings (long vs date)
- Next test fails with mapping conflict on rollup_metadata.continuous.next_window_end_time

Signed-off-by: bowenlan-amzn <bowenlan23@gmail.com>
@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.12%. Comparing base (39b856d) to head (731fe5e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1530      +/-   ##
==========================================
- Coverage   76.16%   76.12%   -0.04%     
==========================================
  Files         375      375              
  Lines       17567    17567              
  Branches     2410     2410              
==========================================
- Hits        13380    13373       -7     
- Misses       2946     2949       +3     
- Partials     1241     1245       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bowenlan-amzn bowenlan-amzn marked this pull request as ready for review November 17, 2025 17:22
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.

Flaky tests

1 participant