Skip to content

Conversation

@guojialiang92
Copy link
Contributor

@guojialiang92 guojialiang92 commented Aug 14, 2025

Description

I reproduced this test locally. The exception information is as follows:

java.lang.AssertionError: 
Expected: <false>
     but: was <true>
Expected :<false>
Actual   :<true>
<Click to see difference>


	at __randomizedtesting.SeedInfo.seed([F428F8558C5C421A:F562F312881C0B75]:0)
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
	at org.junit.Assert.assertThat(Assert.java:964)
	at org.junit.Assert.assertThat(Assert.java:930)
	at org.opensearch.ingest.common.CopyProcessorTests.testCopyWithIgnoreMissing(CopyProcessorTests.java:70)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1750)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:938)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:974)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:988)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.apache.lucene.tests.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:48)
	at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
	at org.apache.lucene.tests.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:45)
	at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
	at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468)
	at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:947)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:832)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:883)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:894)
	at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.tests.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:38)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.tests.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
	at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
	at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
	at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
	at org.apache.lucene.tests.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:47)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Reproduce

Running the following test will reproduce the problem consistently.

REPRODUCE WITH: ./gradlew 'null' --tests 'org.opensearch.ingest.common.CopyProcessorTests.testCopyWithIgnoreMissing' -Dtests.seed=F428F8558C5C421A -Dtests.locale=fr-CD -Dtests.timezone=Europe/London -Druntime.java=21

Analysis

assertThat(ingestDocument.hasField(targetFieldName), equalTo(false));

The problem occurred in the above assert.

IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random());
String targetFieldName = RandomDocumentPicks.randomFieldName(random());

If we use RandomDocumentPicks.randomFieldName, we cannot guarantee that randomly generated targetFieldName will definitely not be included in ingestDocument's fieldNames.

Solve

Use RandomDocumentPicks.randomNonExistingFieldName instead of RandomDocumentPicks.randomFieldName.
After the fix, running locally 1000 times did not encounter any issues again.

Related Issues

Resolves #19040

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
@guojialiang92 guojialiang92 requested a review from a team as a code owner August 14, 2025 12:54
@github-actions
Copy link
Contributor

❌ Gradle check result for e944575: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions github-actions bot added >test-failure Test failure from CI, local build, etc. autocut flaky-test Random test failure that succeeds on second run labels Aug 14, 2025
Copy link
Member

@sandeshkr419 sandeshkr419 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 identifying & fixing this!

@github-actions
Copy link
Contributor

✅ Gradle check result for e944575: SUCCESS

@codecov
Copy link

codecov bot commented Aug 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.96%. Comparing base (292407b) to head (e944575).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19074      +/-   ##
============================================
- Coverage     73.02%   72.96%   -0.07%     
+ Complexity    69548    69469      -79     
============================================
  Files          5647     5647              
  Lines        319106   319106              
  Branches      46163    46163              
============================================
- Hits         233034   232820     -214     
- Misses        67232    67401     +169     
- Partials      18840    18885      +45     

☔ 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.

@andrross andrross merged commit 82ebf3b into opensearch-project:main Aug 14, 2025
42 of 45 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 14, 2025
Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
(cherry picked from commit 82ebf3b)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
RajatGupta02 pushed a commit to RajatGupta02/OpenSearch that referenced this pull request Aug 18, 2025
Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
karenyrx pushed a commit to karenyrx/OpenSearch that referenced this pull request Aug 21, 2025
Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
atris pushed a commit to atris/OpenSearch that referenced this pull request Aug 28, 2025
Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
andrross pushed a commit that referenced this pull request Aug 29, 2025
(cherry picked from commit 82ebf3b)

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kh3ra pushed a commit to kh3ra/OpenSearch that referenced this pull request Sep 5, 2025
Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
vinaykpud pushed a commit to vinaykpud/OpenSearch that referenced this pull request Sep 26, 2025
Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
sokdak pushed a commit to sokdak/OpenSearch that referenced this pull request Oct 15, 2025
…roject#19078)

(cherry picked from commit 82ebf3b)

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autocut backport 2.19 flaky-test Random test failure that succeeds on second run skip-changelog >test-failure Test failure from CI, local build, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AUTOCUT] Gradle Check Flaky Test Report for CopyProcessorTests

3 participants