Ignore .writing files in Integration samples tests

Previously, a temporary .writing file could be found and an attempt made to
access its contents. If the temporary file was deleted between it being found
and its contents being read, the test would fail with a FileNotFoundException.

This commit updates the test to ignore .writing files so that it will only
examine the contents of the final file once Integration has finished
writing it an atomically moved it to its final location.
pull/15310/head
Andy Wilkinson 6 years ago
parent f6a22a05b8
commit ac77fc9dcf

@ -113,7 +113,9 @@ public class SampleIntegrationApplicationTests {
.getResourcePatternResolver(new DefaultResourceLoader())
.getResources("file:target/output/**");
for (Resource candidate : candidates) {
if (candidate.contentLength() == 0) {
if ((candidate.getFilename() != null
&& candidate.getFilename().endsWith(".writing"))
|| candidate.contentLength() == 0) {
return new Resource[0];
}
}

Loading…
Cancel
Save