Skip to content

Conversation

@adoroszlai
Copy link
Contributor

What changes were proposed in this pull request?

Fix intermittent failure in TestWritableRatisContainerProvider#skipsPipelineWithoutContainer.

One of the pipelines has a container (stubbing for getMatchingContainer), the other doesn't. Mocks return null for calls without stubbing, and the test relies on that for the pipeline without container. The problem is that Mockito is also strict by default. When it sees the non-stubbed pipeline, it reports this error. Pipelines are returned by getPipelines in the right order (one without container first), but the order in which they are actually checked depends on PipelineChoosePolicy.

The problem can be reproduced by changing the test case to @RepeatedTest(100).

The fix sets lenient mode for Mockito in the test class to be able to rely on the default.

This also exposed another problem: lists used by the test as return value for stubbed getPipelines do not support remove (invoked by WritableRatisContainerProvider during iteration of pipelines). This is fixed by wrapping in ArrayList.

https://issues.apache.org/jira/browse/HDDS-10070

How was this patch tested?

Unit test passes with @RepeatedTest(100) (which is left in place to catch such problems in the future).

CI: (pending)

@adoroszlai adoroszlai added the test label Jan 5, 2024
@adoroszlai adoroszlai self-assigned this Jan 5, 2024
Copy link
Contributor

@sodonnel sodonnel left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for quickly fixing this.

@adoroszlai adoroszlai merged commit c39c554 into apache:master Jan 5, 2024
@adoroszlai adoroszlai deleted the HDDS-10070 branch January 5, 2024 16:10
@adoroszlai
Copy link
Contributor Author

Thanks @sodonnel for the review.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants