This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch 3.33.x in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 1ba63be88cb1a511cdbe6fa27d45f7d496676ef7 Author: Lukas Lowinger <[email protected]> AuthorDate: Tue Jul 7 09:32:08 2026 +0200 Check for local Docker socket or remote Docker via DOCKER_HOST --- .../component/aws2/lambda/it/Aws2LambdaTest.java | 12 +++------ .../test/support/aws2/DockerSocketAvailable.java | 30 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/integration-test-groups/aws2/aws2-lambda/src/test/java/org/apache/camel/quarkus/component/aws2/lambda/it/Aws2LambdaTest.java b/integration-test-groups/aws2/aws2-lambda/src/test/java/org/apache/camel/quarkus/component/aws2/lambda/it/Aws2LambdaTest.java index b6491c0c1f..e5819caf1b 100644 --- a/integration-test-groups/aws2/aws2-lambda/src/test/java/org/apache/camel/quarkus/component/aws2/lambda/it/Aws2LambdaTest.java +++ b/integration-test-groups/aws2/aws2-lambda/src/test/java/org/apache/camel/quarkus/component/aws2/lambda/it/Aws2LambdaTest.java @@ -19,8 +19,6 @@ package org.apache.camel.quarkus.component.aws2.lambda.it; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.zip.ZipEntry; @@ -31,11 +29,11 @@ import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.response.ExtractableResponse; +import org.apache.camel.quarkus.test.EnabledIf; import org.apache.camel.quarkus.test.support.aws2.Aws2TestResource; import org.apache.camel.quarkus.test.support.aws2.BaseAWs2TestSupport; +import org.apache.camel.quarkus.test.support.aws2.DockerSocketAvailable; import org.jboss.logging.Logger; -import org.junit.jupiter.api.Assumptions; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; @@ -50,6 +48,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; @DisabledOnOs(value = OS.MAC, disabledReason = "Requires /var/run/docker.sock mount") @QuarkusTest @QuarkusTestResource(Aws2TestResource.class) +@EnabledIf(DockerSocketAvailable.class) class Aws2LambdaTest extends BaseAWs2TestSupport { private static final Logger LOG = Logger.getLogger(Aws2LambdaTest.class); @@ -57,11 +56,6 @@ class Aws2LambdaTest extends BaseAWs2TestSupport { super("/aws2-lambda"); } - @BeforeEach - public void beforeEach() { - Assumptions.assumeTrue(Files.exists(Paths.get("/var/run/docker.sock"))); - } - @Test public void performingOperationsOnLambdaFunctionShouldSucceed() { final String functionName = "cqFunction" + java.util.UUID.randomUUID().toString().replace("-", ""); diff --git a/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/DockerSocketAvailable.java b/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/DockerSocketAvailable.java new file mode 100644 index 0000000000..ee81c6ac89 --- /dev/null +++ b/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/DockerSocketAvailable.java @@ -0,0 +1,30 @@ +/* + * 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. + */ +package org.apache.camel.quarkus.test.support.aws2; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.function.BooleanSupplier; + +public class DockerSocketAvailable implements BooleanSupplier { + @Override + public boolean getAsBoolean() { + // Check for local Docker socket or remote Docker via DOCKER_HOST + return Files.exists(Path.of("/var/run/docker.sock")) + || System.getenv("DOCKER_HOST") != null; + } +}
