This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new e77e2f9d9c Fix SplunkTest for running with remote docker test container
e77e2f9d9c is described below

commit e77e2f9d9cb4e319a14a2b6fa7b66a289be0d0a0
Author: Lukas Lowinger <[email protected]>
AuthorDate: Thu Jul 10 22:35:18 2025 +0200

    Fix SplunkTest for running with remote docker test container
---
 .../splunk/src/main/resources/application.properties   | 17 +++++++++++++++++
 .../camel/quarkus/component/splunk/it/SplunkTest.java  | 18 +++++++++++++++---
 .../splunk/src/test/resources/local_server.conf        |  8 ++++++++
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/integration-tests/splunk/src/main/resources/application.properties 
b/integration-tests/splunk/src/main/resources/application.properties
new file mode 100644
index 0000000000..47eb4f6786
--- /dev/null
+++ b/integration-tests/splunk/src/main/resources/application.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+quarkus.native.resources.includes = target/certs/*.jks
diff --git 
a/integration-tests/splunk/src/test/java/org/apache/camel/quarkus/component/splunk/it/SplunkTest.java
 
b/integration-tests/splunk/src/test/java/org/apache/camel/quarkus/component/splunk/it/SplunkTest.java
index e1a53ef856..4af384b0dc 100644
--- 
a/integration-tests/splunk/src/test/java/org/apache/camel/quarkus/component/splunk/it/SplunkTest.java
+++ 
b/integration-tests/splunk/src/test/java/org/apache/camel/quarkus/component/splunk/it/SplunkTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.quarkus.component.splunk.it;
 
+import java.io.IOException;
+import java.net.SocketException;
 import java.util.Map;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
@@ -26,11 +28,15 @@ import java.util.function.Consumer;
 import java.util.stream.Collectors;
 
 import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.common.ResourceArg;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
+import io.smallrye.certs.Format;
+import io.smallrye.certs.junit5.Certificate;
 import org.apache.camel.component.splunk.ProducerType;
 import org.apache.camel.quarkus.test.DisabledOnArm;
+import org.apache.camel.quarkus.test.support.certificate.TestCertificates;
 import org.apache.camel.quarkus.test.support.splunk.SplunkConstants;
 import org.apache.camel.quarkus.test.support.splunk.SplunkTestResource;
 import org.apache.commons.lang3.RandomStringUtils;
@@ -45,12 +51,16 @@ import org.junit.jupiter.api.Test;
 import static org.hamcrest.Matchers.anyOf;
 import static org.hamcrest.Matchers.is;
 
+@TestCertificates(docker = true, certificates = {
+        @Certificate(name = "splunk", formats = { Format.PEM, Format.PKCS12 }, 
password = "password"),
+})
 @QuarkusTest
-@QuarkusTestResource(value = SplunkTestResource.class)
+@QuarkusTestResource(value = SplunkTestResource.class, initArgs = {
+        @ResourceArg(name = "certName", value = "splunk") })
 @DisabledOnArm
 public class SplunkTest {
 
-    private final static int TIMEOUT_IN_SECONDS = 60;
+    private final static int TIMEOUT_IN_SECONDS = 180;
 
     @Test
     public void testNormalSearchWithSubmitWithRawData() throws 
InterruptedException {
@@ -119,8 +129,10 @@ public class SplunkTest {
 
     @Test
     public void testSavedSearchWithTcpNoSSL() {
-        Assertions.assertThrowsExactly(NoHttpResponseException.class,
+        Exception exception = Assertions.assertThrows(IOException.class,
                 () -> testSavedSearchWithTcp(false));
+        // in case of Splunk connected remotely, it can behaves differently 
from localhost loopback (ie. it throws `java.net.SocketException: Connection 
reset`)
+        Assertions.assertTrue(exception instanceof NoHttpResponseException || 
exception instanceof SocketException);
     }
 
     void testSavedSearchWithTcp(boolean ssl) throws InterruptedException {
diff --git a/integration-tests/splunk/src/test/resources/local_server.conf 
b/integration-tests/splunk/src/test/resources/local_server.conf
index ed21133c7a..93a12d0e87 100644
--- a/integration-tests/splunk/src/test/resources/local_server.conf
+++ b/integration-tests/splunk/src/test/resources/local_server.conf
@@ -3,6 +3,14 @@ serverName = b66b768099db
 pass4SymmKey = $7$oeVDSaCZOSOMIVB0Yv2lBqldGvLt0pXWuQdDV7YvZ0d6Kwf/f0RwhQ==
 allowRemoteLogin = always
 
+[sslConfig]
+caTrustStore = splunk
+serverCert = /opt/splunk/etc/auth/mycerts/myServerCert.pem
+sslPassword = password
+requireClientCert = false
+cipherSuite = ECDHE-RSA-AES256-GCM-SHA384
+sslRootCAPath = /opt/splunk/etc/auth/mycerts/cacert.pem
+
 [lmpool:auto_generated_pool_download-trial]
 description = auto_generated_pool_download-trial
 peers = *

Reply via email to