Build: #2335 was successful
Job: Deploy was successful
Code commits
openmrs-core
-
teleivo <teleivo@users.noreply.github.com> 0ee2d1f6bcde882268a76062efef640b8360e088
TRUNK-5816 Close streams in test
both tests fail on Windows with an error like
[INFO] Running org.openmrs.obs.BinaryStreamHandlerTest
Jul 17, 2020 11:42:59 AM org.junit.jupiter.engine.execution.JupiterEngineExecutionContext close
SEVERE: Caught exception while closing extension context: org.junit.jupiter.engine.descriptor.MethodExtensionContext@4fa274
java.io.IOException: Failed to delete temp directory ...\AppData\Local\Temp\junit9081338062257189768. The following paths could not be deleted (see suppressed exceptions for details): , TestingComplexObsSaving_1d883c5b-ae87-4e42-b5aa-2171b58c51da.dat, TestingComplexObsSaving_27cc4781-b820-466d-834c-70b4d221d24f.dat
...
Suppressed: java.nio.file.FileSystemException: ...\AppData\Local\Temp\junit9081338062257189768\TestingComplexObsSaving_1d883c5b-ae87-4e42-b5aa-2171b58c51da.dat: The process cannot access the file because it is being used by another process.
Looking at https://github.com/spring-io/initializr/issues/862 it could
well be that we are facing the same problem that we are not properly
closing our streams before exiting the test. Thus wrapping them in a
try-with resource block.
This theory makes sense since the saveObs uses OpenmrsUtil.copyFile
which does not close the inputstream but only the outputstream.- api/src/test/java/org/openmrs/obs/BinaryStreamHandlerTest.java (version 0ee2d1f6bcde882268a76062efef640b8360e088)
- api/src/test/java/org/openmrs/obs/MediaHandlerTest.java (version 0ee2d1f6bcde882268a76062efef640b8360e088)