NIFI-13352 Adjusted Shutdown handling in ListenOTLP and Test Class

This closes #8913

- Added quick duration for shutdown quiet period in ListenOTLP HttpServerFactory
- Added TestRunner.stop() to ListenOTLPTest to close listening sockets
- Increased Connect Timeout from 5 to 10 seconds in ListenOTLPTest

Signed-off-by: Joseph Witt <joewitt@apache.org>
This commit is contained in:
exceptionfactory 2024-06-03 16:10:23 -05:00 committed by Joseph Witt
parent b768b23e0f
commit ab2cea4c22
No known key found for this signature in database
GPG Key ID: 9093BF854F811A1A
2 changed files with 12 additions and 1 deletions

View File

@ -20,6 +20,8 @@ import com.google.protobuf.Message;
import io.netty.handler.codec.http2.Http2SecurityUtil;
import io.netty.handler.ssl.ApplicationProtocolNames;
import io.netty.handler.ssl.SupportedCipherSuiteFilter;
import org.apache.nifi.event.transport.configuration.ShutdownQuietPeriod;
import org.apache.nifi.event.transport.configuration.ShutdownTimeout;
import org.apache.nifi.event.transport.configuration.TransportProtocol;
import org.apache.nifi.event.transport.netty.NettyEventServerFactory;
import org.apache.nifi.event.transport.netty.channel.LogExceptionChannelHandler;
@ -55,6 +57,9 @@ public class HttpServerFactory extends NettyEventServerFactory {
new HttpProtocolNegotiationHandler(log, messages),
logExceptionChannelHandler
));
setShutdownQuietPeriod(ShutdownQuietPeriod.QUICK.getDuration());
setShutdownTimeout(ShutdownTimeout.QUICK.getDuration());
}
private SSLParameters getApplicationSslParameters(final SSLContext sslContext) {

View File

@ -45,6 +45,7 @@ import org.apache.nifi.web.client.api.HttpResponseEntity;
import org.apache.nifi.web.client.api.HttpResponseStatus;
import org.apache.nifi.web.client.api.WebClientService;
import org.apache.nifi.web.client.ssl.TlsContext;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -125,7 +126,7 @@ class ListenOTLPTest {
private static final byte[] EMPTY_BYTES = new byte[]{};
private static final Duration CONNECT_TIMEOUT = Duration.ofSeconds(5);
private static final Duration CONNECT_TIMEOUT = Duration.ofSeconds(10);
private static final Duration READ_TIMEOUT = Duration.ofSeconds(5);
@ -205,6 +206,11 @@ class ListenOTLPTest {
webClientService = standardWebClientService;
}
@AfterEach
void stopRunner() {
runner.stop();
}
@Test
void testRequiredProperties() throws InitializationException {
runner.assertNotValid();