1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00

Make tests more reliable

This commit is contained in:
carbotaniuman 2021-01-25 13:00:40 -06:00
parent 4e8b5a83e0
commit 635d029357
2 changed files with 13 additions and 3 deletions

View file

@ -40,6 +40,19 @@ public class CachingInputStream extends ProxyInputStream {
@Override @Override
public void close() throws IOException { public void close() throws IOException {
if (read() == EOF) {
try {
in.close();
} catch (IOException ignored) {
}
try {
cache.close();
} catch (IOException ignored) {
}
onClose.run();
return;
}
executor.submit(() -> { executor.submit(() -> {
try { try {
IOUtils.copy(in, cache); IOUtils.copy(in, cache);

View file

@ -150,9 +150,6 @@ class ImageServerTest : FreeSpec() {
response.shouldHaveHeader("Content-Length", mockData.size.toString()) response.shouldHaveHeader("Content-Length", mockData.size.toString())
IOUtils.toByteArray(response.body.stream).shouldBe(mockData) IOUtils.toByteArray(response.body.stream).shouldBe(mockData)
response.close() response.close()
// wait for the executor to commit
delay(100)
} }
} }
} }