Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Flaky test in DataFileLoaderTest #3470

Closed
Tracked by #3481 ...
dlvenable opened this issue Oct 10, 2023 · 7 comments
Closed
Tracked by #3481 ...

[BUG] Flaky test in DataFileLoaderTest #3470

dlvenable opened this issue Oct 10, 2023 · 7 comments
Labels
bug Something isn't working maintenance Issues to help maintain the project, such as improving builds, testing, etc.

Comments

@dlvenable
Copy link
Member

Describe the bug

> Task :data-prepper-plugins:dynamodb-source:test

DataFileLoaderTest > test_run_loadFile_correctly() FAILED
    org.mockito.exceptions.verification.WantedButNotInvoked at DataFileLoaderTest.java:139

Example failure:

https://github.com/opensearch-project/data-prepper/actions/runs/6470850267/job/17567944366?pr=3469

To Reproduce

This is flaky, so this might require some investigation.

Expected behavior

This test should consistently pass.

@dlvenable dlvenable added bug Something isn't working maintenance Issues to help maintain the project, such as improving builds, testing, etc. labels Oct 10, 2023
@dlvenable
Copy link
Member Author

@daixba , Could you take a look at this flaky test?

@daixba
Copy link
Contributor

daixba commented Oct 11, 2023

Sure, I will work on this.

I have seen this before, it's strange that it does not fail all the time and I can't reproduce this failure in my local. My best guess is that there is no enough 'time' before the 'expected invoke' to happen due in the github ci instance.

@dlvenable
Copy link
Member Author

Recently failing test running on Java 11:

> Task :data-prepper-plugins:dynamodb-source:test

DataFileLoaderTest > run_loadFile_with_acknowledgments_processes_correctly() FAILED
    org.mockito.exceptions.verification.WantedButNotInvoked at DataFileLoaderTest.java:222

@daixba
Copy link
Contributor

daixba commented Nov 6, 2023

The Flaky issue (DataFileLoaderTest.java:222) regarding flush() wanted but not invoked is because there was

private final int total = random.nextInt(10);

in the test code to generate random number of test records.

However, I just noticed that the 0 is inclusive for nextInt() method, hence, there is a small chance that the total records is 0. In which case, the flush() was not invoked.

I have run the test again and again and confirm that only when total == 0, the test failed. I was trying to fix this issue by adding at least 1 to the total count. However, this test was already modified.

Let's see if this issue still exists.

@dlvenable
Copy link
Member Author

Yes, roughly 1 out of 10 times that condition should occur, so I think that is likely the fix. For the future, would be nice to have had a separate PR so that such a nice fix is not blocked by other PR comments.

@dlvenable
Copy link
Member Author

Resolved by #3592.

@github-project-automation github-project-automation bot moved this from Unplanned to Done in Data Prepper Tracking Board Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working maintenance Issues to help maintain the project, such as improving builds, testing, etc.
Projects
Archived in project
Development

No branches or pull requests

2 participants