Skip to content

Commit

Permalink
Use docker exec instead of docker cp to create run script for Kafka n…
Browse files Browse the repository at this point in the history
…ative DevService
  • Loading branch information
xstefank committed Feb 15, 2024
1 parent 6182f88 commit 079b2b7
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 079b2b7

Please sign in to comment.