This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new ab2cea4c22 NIFI-13352 Adjusted Shutdown handling in ListenOTLP and
Test Class This closes #8913
ab2cea4c22 is described below
commit ab2cea4c229f71ff9c967cb36e70328b3027fa57
Author: exceptionfactory <[email protected]>
AuthorDate: Mon Jun 3 16:10:23 2024 -0500
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 <[email protected]>
---
.../nifi/processors/opentelemetry/server/HttpServerFactory.java | 5 +++++
.../org/apache/nifi/processors/opentelemetry/ListenOTLPTest.java | 8 +++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git
a/nifi-extension-bundles/nifi-opentelemetry-bundle/nifi-opentelemetry-processors/src/main/java/org/apache/nifi/processors/opentelemetry/server/HttpServerFactory.java
b/nifi-extension-bundles/nifi-opentelemetry-bundle/nifi-opentelemetry-processors/src/main/java/org/apache/nifi/processors/opentelemetry/server/HttpServerFactory.java
index 48ef1f97db..3cf206eb97 100644
---
a/nifi-extension-bundles/nifi-opentelemetry-bundle/nifi-opentelemetry-processors/src/main/java/org/apache/nifi/processors/opentelemetry/server/HttpServerFactory.java
+++
b/nifi-extension-bundles/nifi-opentelemetry-bundle/nifi-opentelemetry-processors/src/main/java/org/apache/nifi/processors/opentelemetry/server/HttpServerFactory.java
@@ -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) {
diff --git
a/nifi-extension-bundles/nifi-opentelemetry-bundle/nifi-opentelemetry-processors/src/test/java/org/apache/nifi/processors/opentelemetry/ListenOTLPTest.java
b/nifi-extension-bundles/nifi-opentelemetry-bundle/nifi-opentelemetry-processors/src/test/java/org/apache/nifi/processors/opentelemetry/ListenOTLPTest.java
index cdee2ef8fc..15cdb560aa 100644
---
a/nifi-extension-bundles/nifi-opentelemetry-bundle/nifi-opentelemetry-processors/src/test/java/org/apache/nifi/processors/opentelemetry/ListenOTLPTest.java
+++
b/nifi-extension-bundles/nifi-opentelemetry-bundle/nifi-opentelemetry-processors/src/test/java/org/apache/nifi/processors/opentelemetry/ListenOTLPTest.java
@@ -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();