Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker exec instead of docker cp to create run script for Kafka native DevService #38790

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading