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
NIFI-11778 refactored Groovy tests in nifi-elasticsearch-restapi-processors to Java (and JUnit 5) #7537
Conversation
Thanks for putting in the work on this large refactoring effort @dan-s1! @ChrisSamo632 and @MikeThomsen have put in a good bit of work on the Elasticsearch components, so they would be in a good position to evaluate these changes. |
@exceptionfactory I see Ubuntu Zulu JDK 17 EN and i-workflow / Windows Zulu JDK 17 FR failed but the errors are not related to the code I checked in. The failure on ci-workflow / MacOS Temurin JDK 17 JP is related to my code but I am not sure why it is failing as on my box it is working fine. I am guessing there is a timezone issue though I would like to see the whether the other builds also fail or not to determine conclusively. |
@dan-s1 I re-triggered the Checks, definitely looks like ES related assertion failures now (originally you were right that the tests for for some unrelated transient issue)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the big refactor @dan-s1 - couple of code style/suggestions from me, plus worth considering breaking up some of the larger test cases that have grown to be somewhat unmaintainable over time - now seems a sensible opportunity to refactor those
Plus you've some tests failing in the Checks/when run locally that need fixing
Also, this is a duplicate of NIFI-9290
...ch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/IndexOperationRequest.java
Outdated
Show resolved
Hide resolved
...va/org/apache/nifi/processors/elasticsearch/AbstractPaginatedJsonQueryElasticsearchTest.java
Outdated
Show resolved
Hide resolved
...va/org/apache/nifi/processors/elasticsearch/AbstractPaginatedJsonQueryElasticsearchTest.java
Outdated
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...ocessors/src/test/java/org/apache/nifi/processors/elasticsearch/SearchElasticsearchTest.java
Outdated
Show resolved
Hide resolved
@ChrisSamo632 Do you have any suggestions how to reproduce these failures? On my local box all unit tests are passing. I thought it might be a locale issue and I tried setting the locale to "FR" with but the unit test still passed. |
NM I got it to fail by using this
|
This comment was marked as duplicate.
This comment was marked as duplicate.
@ChrisSamo632 Sorry by accident closed this PR and the reopened. Would it be okay to fix the test errors by placing in
I realized the timezone was the issue from the second answer in this post.
Based on the aformentioned post I deduced since my default timezone is UTC the tests passed on my box because then |
I'm not sure this sounds like the right way to fix this - the Checks run against multiple timezones for good reason, we want to be sure that processors can handle changes in locale. Having to set the tests to use a specific timezone to pass, seems like we might be hiding a potential issue either in the tests or the processor code itself. Unfortunately, handling multiple timezones isn't my strong suite, although I'll try to take a look. I wonder whether @exceptionfactory or @markap14 might be able to provide some guidance on this one? |
I will try to take a closer look at the tests soon, but I agree, changing the default timezone in test setup code is not the right approach. All of the automated builds run with different timezones to ensure expected behavior in various locations, so all tests must pass without changing the system timezone. In general, the issue means that there is some timezone conversion happening, which could point to a runtime issue, or simply an issue with the sample data used for testing. I'm not sure exactly why this has not surfaced earlier, so it points to an issue with the test-related changes. |
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have suggested some new test case names as requested @dan-s1
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...cessors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchJsonTest.java
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Outdated
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Show resolved
Hide resolved
...ssors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java
Show resolved
Hide resolved
...ocessors/src/test/java/org/apache/nifi/processors/elasticsearch/SearchElasticsearchTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for continuing with the refactor @dan-s1 - a few comments on the lastest commit, but definitely moving in the right direction
@ChrisSamo632 Checking in to see if my latest changes are okay. Thanks! |
@dan-s1 I've been away, but hoping to take a look at your latest changes soon/this week. Note that you've now got some conflicts after #7441 was recently merged - couple of new tests to migrate over for the updated processors |
@ChrisSamo632 Do I manually cut and paste those changes to my branch since those Groovy files have been deleted in my branch? |
I'd guess so, and make them work for the Java setup rather than Groovy |
@exceptionfactory Just double checking before I proceed that the way to resolve the conflicts is for me to cut and paste the changes from #7441 to my code. Thanks! |
Yes, copying over and converting the new unit tests is the way to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dan-s1 had a go at more completely suggesting the changes I was thinking about previously to rationalise the testPagination
and related methods between the AbstractPaginatedJsonQueryElasticsearchTest
and child classes
This, hopefully, shows that these two classes should behave much the same and make it easier to maintain these tests in the future
...va/org/apache/nifi/processors/elasticsearch/AbstractPaginatedJsonQueryElasticsearchTest.java
Outdated
Show resolved
Hide resolved
...ocessors/src/test/java/org/apache/nifi/processors/elasticsearch/SearchElasticsearchTest.java
Show resolved
Hide resolved
...ocessors/src/test/java/org/apache/nifi/processors/elasticsearch/SearchElasticsearchTest.java
Outdated
Show resolved
Hide resolved
...ocessors/src/test/java/org/apache/nifi/processors/elasticsearch/SearchElasticsearchTest.java
Outdated
Show resolved
Hide resolved
.../test/java/org/apache/nifi/processors/elasticsearch/PaginatedJsonQueryElasticsearchTest.java
Outdated
Show resolved
Hide resolved
.../test/java/org/apache/nifi/processors/elasticsearch/PaginatedJsonQueryElasticsearchTest.java
Outdated
Show resolved
Hide resolved
@ChrisSamo632 I am trying to implement the changes from #7441 For |
@ChrisSamo632 NM I forgot to account for the changes to |
@ChrisSamo632 I have made the changes you had requested. I also incorporated the changes from #7441. I broke up
and I refactored out the common code into the method |
@dan-s1 I'll take a look shortly hopefully, but note that you've still got some conflicts with |
@ChrisSamo632 I am not sure I can do anything regarding these conflicts. I already incorporated the changes of #7441 for |
@dan-s1 You will need to rebase your PR and then force-push to this feature branch to resolve the conflicts. If you have already incorporated the changes, then during the rebase process, you should be able to just mark the |
…csearch-restapi-processors to Java (and JUnit 5)
…archTest and PaginatedJsonQueryElasticsearchTest and incorporated the changes from apache#7441.
@exceptionfactory Thanks for the clarification. I have made those changes and pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for continuing with the updates @dan-s1; provided the checks pass (these tests all work for me locally at least), I'm happy to merge
…essors to Java (and JUnit 5) This closes #7537 Signed-off-by: Chris Sampson <chris.sampson82@gmail.com>
Summary
NIFI-11778 / NIFI-9290
Refactored all the Groovy unit tests in nifi-elasticsearch-restapi-processors to Java.
Along with the refactor, the building of the individual JSON documents were removed and replaced with files which are now read in thereby reducing the size of the unit tests and increasing the readability of the unit tests.
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000
NIFI-00000
Pull Request Formatting
main
branchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-check
Licensing
LICENSE
andNOTICE
filesDocumentation