From 079b2b79e3604ad32986fc6a258b77e0130e6c30 Mon Sep 17 00:00:00 2001 From: xstefank Date: Wed, 14 Feb 2024 15:35:06 +0100 Subject: [PATCH] Use docker exec instead of docker cp to create run script for Kafka native DevService --- .../client/deployment/KafkaNativeContainer.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaNativeContainer.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaNativeContainer.java index b6fff5fd04a9c..2381592c4fd5b 100644 --- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaNativeContainer.java +++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaNativeContainer.java @@ -1,12 +1,10 @@ package io.quarkus.kafka.client.deployment; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.wait.strategy.Wait; -import org.testcontainers.images.builder.Transferable; import org.testcontainers.utility.DockerImageName; import com.github.dockerjava.api.command.InspectContainerResponse; @@ -59,10 +57,13 @@ protected void containerIsStarting(InspectContainerResponse containerInfo, boole cmd += " " + additionalArgs; } - //noinspection OctalInteger - copyFileToContainer( - Transferable.of(cmd.getBytes(StandardCharsets.UTF_8), 0777), - STARTER_SCRIPT); + // docker exec since docker cp doesn't work with kubedock yet + try { + execInContainer("sh", "-c", + String.format("echo -e \"%1$s\" >> %2$s && chmod 777 %2$s", cmd, STARTER_SCRIPT)); + } catch (Exception e) { + throw new RuntimeException("Can't create run script in the Kafka native container.", e); + } } private String getKafkaAdvertisedListeners() {