mirror of
https://gitlab.com/mangadex-pub/mangadex_at_home.git
synced 2024-11-17 00:22:32 +01:00
Make tests more reliable
This commit is contained in:
parent
4e8b5a83e0
commit
635d029357
@ -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);
|
||||||
|
@ -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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user