diff --git a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/LocalFileFetcher.java b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/LocalFileFetcher.java index 0b22b9aab..e8cb9cada 100644 --- a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/LocalFileFetcher.java +++ b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/LocalFileFetcher.java @@ -32,7 +32,10 @@ public List fetchFiles() { .filter(path -> path.toString().endsWith(EXTENSION)) .map( p -> { - try (InputStream inputStream = Files.newInputStream(p)) { + try { + // Need to keep the input stream open until the test is done + // Must make sure to close the input stream after use + InputStream inputStream = Files.newInputStream(p); return new HL7FileStream( p.getFileName().toString(), inputStream); } catch (IOException e) { diff --git a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy index aca25da81..5cb1cd713 100644 --- a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy +++ b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy @@ -43,6 +43,11 @@ class AutomatedTest extends Specification { TestApplicationContext.injectRegisteredImplementations() } + def cleanup() { + for (HL7FileStream fileStream : recentLocalFiles + recentAzureFiles) { + fileStream.inputStream().close() + } + } def "test defined assertions on relevant messages"() { given: