NIFI-12041 Converted Groovy tests in nifi-scripting-bundle/nifi-scripting-processors to Java. - #7752
NIFI-12041 Converted Groovy tests in nifi-scripting-bundle/nifi-scripting-processors to Java.#7752dan-s1 wants to merge 5 commits into
Conversation
…ting-processors to Java.
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the contribution @dan-s1. It looks like the branch does not reflect the latest Groovy package versions, can you review and correct the dependency package names?
exceptionfactory
left a comment
There was a problem hiding this comment.
@dan-s1 The automated build on Windows has failed multiple times on the ScriptedReaderTest, attempting to delete a file. It looks like the Java process has not released a lock on files in the temporary directory, causing the problem. You could try disabling the RecordReaderFactory Controller Service after the final assertion, but that may not release the lock. If all else fails, removing that test method is acceptable in this scenario.
Error: Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.658 s <<< FAILURE! -- in org.apache.nifi.record.script.ScriptedReaderTest
Error: org.apache.nifi.record.script.ScriptedReaderTest.testRecordReaderGroovyScriptChangeModuleDirectory(Path) -- Time elapsed: 0.564 s <<< ERROR!
java.io.IOException: Failed to delete temp directory C:\Users\RUNNER~1\AppData\Local\Temp\junit7656749993287821052. The following paths could not be deleted (see suppressed exceptions for details): <root>
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Suppressed: java.nio.file.FileSystemException: C:\Users\RUNNER~1\AppData\Local\Temp\junit7656749993287821052: The process cannot access the file because it is being used by another process
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:275)
at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
at java.base/java.nio.file.Files.delete(Files.java:1152)
at java.base/java.nio.file.Files.walkFileTree(Files.java:2811)
at java.base/java.nio.file.Files.walkFileTree(Files.java:2882)
... 13 more
Suppressed: java.nio.file.FileSystemException: C:\Users\RUNNER~1\AppData\Local\Temp\junit7656749993287821052: The process cannot access the file because it is being used by another process
... 21 more
|
@exceptionfactory It seems there is an issue with Junit 5 TempDir on Windows. I found this issue. Though the title indicates the issue is with Java 11, reading further indicates it is also an issue with Java 17 which is what we are running with. It seems this was already an issue in #5791 (which is referenced in the above issue) and the solution there was to disable the test on Windows. Is that what should be done here also? |
Disabling the test on Windows is an option, although the fact of failure more likely points to some subtle resource handling issue. Disabling on Windows seems sufficient for this one test method. |
|
Another option mentioned in the ticket involves not using the |
…ith a Junit5 TempDir annotation and instead used a temp file in attempt to avoid a Windows issue with failing to delete the junit temp directory.
|
@exceptionfactory I made the changes. That one test was actually using an instance variable and a method variable both annotated with |
|
@exceptionfactory That worked. Though I realize its not a big deal would it be better just to put the creation and deletion of the temp jar file inside the test instead of having it as a class variable? This would obviate the need for the |
Thanks for making the changes, glad to see the latest builds worked across the board. I think the current approach works, otherwise it would require try-finally handling in the test method. |
exceptionfactory
left a comment
There was a problem hiding this comment.
@dan-s1 I noted one more issue where the anonymous Processor implementations can be replaced with NoOpProcessor.class. Other than that, this should be good to go.
…essor and made some formatting changes.
|
@exceptionfactory Thanks for the clarification on those formatting changes. All requested changes have been made. |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for making the adjustments @dan-s1, the latest version looks good! +1 merging
Summary
NIFI-12041
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000Pull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation