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

Mockito 5 #4712

Merged
merged 4 commits into from
Jul 11, 2024
Merged

Mockito 5 #4712

merged 4 commits into from
Jul 11, 2024

Conversation

dlvenable
Copy link
Member

@dlvenable dlvenable commented Jul 8, 2024

Description

Use Mockito 5.

  • Update Mockito to 5.12.0
  • Removes use of the mockito-inline project as this is now the default
  • Use the new package for the JUnit 4 runner
  • Remove all org.mockito.plugins.MockMaker files since inline is now the default
  • Removes PowerMock as this is not necessary anymore.

Issues Resolved

N/A

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

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: David Venable <dlv@amazon.com>
Copy link
Collaborator

@KarstenSchnitter KarstenSchnitter 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 providing the change. To me, the main thing with that change is, that all builds and tests should be successful after merge. Unfortunately, the Gradle builds are failing as are some of the tests. Would be nice to see them in green to validate this change.

Signed-off-by: David Venable <dlv@amazon.com>
Signed-off-by: David Venable <dlv@amazon.com>
…cs. Updates to MetricsTestUtil to provide clarity on NPEs.

Signed-off-by: David Venable <dlv@amazon.com>
@dlvenable
Copy link
Member Author

Thanks for providing the change. To me, the main thing with that change is, that all builds and tests should be successful after merge. Unfortunately, the Gradle builds are failing as are some of the tests. Would be nice to see them in green to validate this change.

@KarstenSchnitter ,

Yes, I agree with getting the tests to green. I found some issues and resolved them. Now the tests are mostly to green. There are enough flaky tests to where I've not had all successful runs.

Also, the Kafka plugin integration tests tests fail consistently.

Copy link
Collaborator

@KarstenSchnitter KarstenSchnitter left a comment

Choose a reason for hiding this comment

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

Great to see the tests are green now. There are three places, where the tests now only consist of Mockito configuration without any directly apparent call to production code. Not sure, whether this can be improved.

@dlvenable
Copy link
Member Author

@KarstenSchnitter ,

Great to see the tests are green now.

Yes, me too! We still have a number of flaky tests.

I created #4723 to resolve a flaky test in the new AWS Lambda sink. This one was failing 18 out of 20 times when I locally set it to be a @RepeatedTest. Feel free to take a look at that one as well.

Copy link
Collaborator

@KarstenSchnitter KarstenSchnitter left a comment

Choose a reason for hiding this comment

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

I think, this is fine to go.

@dlvenable dlvenable merged commit 8a1a416 into opensearch-project:main Jul 11, 2024
72 of 74 checks passed
@dlvenable dlvenable deleted the mockito-5 branch July 12, 2024 14:18
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this pull request Jul 23, 2024
Mockito 5

* Synchronize the MetricsTestUtil methods to avoid test failures.
* Create a copy of the collections to remove in MetricsTestUtil.
* Updated two tests to JUnit 5 and to use mocks instead of actual metrics. Updates to MetricsTestUtil to provide clarity on NPEs.

Signed-off-by: David Venable <dlv@amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this pull request Jul 23, 2024
Mockito 5

* Synchronize the MetricsTestUtil methods to avoid test failures.
* Create a copy of the collections to remove in MetricsTestUtil.
* Updated two tests to JUnit 5 and to use mocks instead of actual metrics. Updates to MetricsTestUtil to provide clarity on NPEs.

Signed-off-by: David Venable <dlv@amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this pull request Jul 30, 2024
Mockito 5

* Synchronize the MetricsTestUtil methods to avoid test failures.
* Create a copy of the collections to remove in MetricsTestUtil.
* Updated two tests to JUnit 5 and to use mocks instead of actual metrics. Updates to MetricsTestUtil to provide clarity on NPEs.

Signed-off-by: David Venable <dlv@amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this pull request Aug 8, 2024
Mockito 5

* Synchronize the MetricsTestUtil methods to avoid test failures.
* Create a copy of the collections to remove in MetricsTestUtil.
* Updated two tests to JUnit 5 and to use mocks instead of actual metrics. Updates to MetricsTestUtil to provide clarity on NPEs.

Signed-off-by: David Venable <dlv@amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this pull request Aug 12, 2024
Mockito 5

* Synchronize the MetricsTestUtil methods to avoid test failures.
* Create a copy of the collections to remove in MetricsTestUtil.
* Updated two tests to JUnit 5 and to use mocks instead of actual metrics. Updates to MetricsTestUtil to provide clarity on NPEs.

Signed-off-by: David Venable <dlv@amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this pull request Aug 14, 2024
Mockito 5

* Synchronize the MetricsTestUtil methods to avoid test failures.
* Create a copy of the collections to remove in MetricsTestUtil.
* Updated two tests to JUnit 5 and to use mocks instead of actual metrics. Updates to MetricsTestUtil to provide clarity on NPEs.

Signed-off-by: David Venable <dlv@amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
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.

2 participants