Skip to content

Commit

Permalink
Merge pull request quarkusio#38790 from xstefank/kafka-native-kubedock
Browse files Browse the repository at this point in the history
Use docker exec instead of docker cp to create run script for Kafka native DevService
  • Loading branch information
geoand authored Feb 16, 2024
2 parents b5617f6 + 079b2b7 commit 1092bbc
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 1092bbc

Please sign in to comment.