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-examples.git


The following commit(s) were added to refs/heads/3.33.x by this push:
     new 0de2f92e Use filesystembind instead of copytocontainer for secrets
0de2f92e is described below

commit 0de2f92e1b931f9d30b756186e48279f2914661b
Author: James Netherton <[email protected]>
AuthorDate: Tue Apr 14 14:22:30 2026 +0100

    Use filesystembind instead of copytocontainer for secrets
    
    Co-authored-by: bhavani111 <[email protected]>
---
 .../message/bridge/resource/IBMMQTestResource.java     | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git 
a/message-bridge/src/test/java/org/acme/message/bridge/resource/IBMMQTestResource.java
 
b/message-bridge/src/test/java/org/acme/message/bridge/resource/IBMMQTestResource.java
index c86adaa6..78c5ff07 100644
--- 
a/message-bridge/src/test/java/org/acme/message/bridge/resource/IBMMQTestResource.java
+++ 
b/message-bridge/src/test/java/org/acme/message/bridge/resource/IBMMQTestResource.java
@@ -16,13 +16,17 @@
  */
 package org.acme.message.bridge.resource;
 
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Map;
 
 import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
 import org.eclipse.microprofile.config.ConfigProvider;
+import org.testcontainers.containers.BindMode;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.images.builder.Transferable;
 import org.testcontainers.utility.DockerImageName;
 
 public class IBMMQTestResource implements QuarkusTestResourceLifecycleManager {
@@ -36,13 +40,21 @@ public class IBMMQTestResource implements 
QuarkusTestResourceLifecycleManager {
 
     @Override
     public Map<String, String> start() {
+        Path passwordFile = Paths.get("target").resolve("password");
+        try {
+            Files.writeString(passwordFile, PASSWORD);
+        } catch (IOException e) {
+            throw new RuntimeException("Unable to create password file", e);
+        }
         container = new GenericContainer<>(DockerImageName.parse(IMAGE_NAME))
                 .withExposedPorts(PORT)
                 .withEnv(Map.of(
                         "LICENSE", 
ConfigProvider.getConfig().getValue("ibm.mq.container.license", String.class),
                         "MQ_QMGR_NAME", QUEUE_MANAGER_NAME))
-                .withCopyToContainer(Transferable.of(PASSWORD), 
"/run/secrets/mqAdminPassword")
-                .withCopyToContainer(Transferable.of(PASSWORD), 
"/run/secrets/mqAppPassword")
+                // prefer filesystembind over copytocontainer as copying to 
/run/secrets does not work for rootless podman
+                .withFileSystemBind(passwordFile.toAbsolutePath().toString(), 
"/run/secrets/mqAdminPassword",
+                        BindMode.READ_ONLY)
+                .withFileSystemBind(passwordFile.toAbsolutePath().toString(), 
"/run/secrets/mqAppPassword", BindMode.READ_ONLY)
                 // AMQ5806I is a message code for queue manager start
                 .waitingFor(Wait.forLogMessage(".*AMQ5806I.*", 1));
         container.start();

Reply via email to