Adjust checkForLeaks timeout settings
LeakAwareDataBufferFactory#checkForLeaks automatically waits up to 5 sec for buffers to be released, which could be used as a way of awaiting on some async logic to complete, and as long as buffers are released, it shouldn't be long. However, the leak test in LeakAwareDataBufferFactoryTests actually expects to find a leak, and always ends up waiting the full 5 seconds. This change, makes the wait configurable, with the no-arg method using 0 (no waiting). AbstractLeakCheckingTests uses 1 second by default since ResourceRegionEncoderTests did fail locally. If more tests need this, we can adjust the settings.
This commit is contained in:
@@ -63,7 +63,7 @@ class ResourceRegionEncoderTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldEncodeResourceRegionFileResource() throws Exception {
|
||||
void shouldEncodeResourceRegionFileResource() {
|
||||
ResourceRegion region = new ResourceRegion(
|
||||
new ClassPathResource("ResourceRegionEncoderTests.txt", getClass()), 0, 6);
|
||||
Flux<DataBuffer> result = this.encoder.encode(Mono.just(region), this.bufferFactory,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,8 +35,7 @@ class LeakAwareDataBufferFactoryTests {
|
||||
void leak() {
|
||||
DataBuffer dataBuffer = this.bufferFactory.allocateBuffer();
|
||||
try {
|
||||
assertThatExceptionOfType(AssertionError.class).isThrownBy(
|
||||
this.bufferFactory::checkForLeaks);
|
||||
assertThatExceptionOfType(AssertionError.class).isThrownBy(this.bufferFactory::checkForLeaks);
|
||||
}
|
||||
finally {
|
||||
release(dataBuffer);
|
||||
|
||||
Reference in New Issue
Block a user