Skip to content

Commit

Permalink
[localstack] Add testcontainer marker labels to additional localstack…
Browse files Browse the repository at this point in the history
… flags (#9531)
  • Loading branch information
dfangl authored Nov 20, 2024
1 parent 1facaf0 commit 39ff5f8
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ protected void configure() {
@Override
protected void containerIsStarting(InspectContainerResponse containerInfo) {
String command = "#!/bin/bash\n";
command += "export LAMBDA_DOCKER_FLAGS=" + configureLambdaContainerLabels() + "\n";
command += "export LAMBDA_DOCKER_FLAGS=" + configureServiceContainerLabels("LAMBDA_DOCKER_FLAGS") + "\n";
command += "export ECS_DOCKER_FLAGS=" + configureServiceContainerLabels("ECS_DOCKER_FLAGS") + "\n";
command += "export EC2_DOCKER_FLAGS=" + configureServiceContainerLabels("EC2_DOCKER_FLAGS") + "\n";
command += "export BATCH_DOCKER_FLAGS=" + configureServiceContainerLabels("BATCH_DOCKER_FLAGS") + "\n";
command += "/usr/local/bin/docker-entrypoint.sh\n";
copyFileToContainer(Transferable.of(command, 0777), STARTER_SCRIPT);
}
Expand All @@ -214,13 +217,13 @@ protected void containerIsStarting(InspectContainerResponse containerInfo) {
* chance.
* @return the lambda container labels as a string
*/
private String configureLambdaContainerLabels() {
String lambdaDockerFlags = internalMarkerLabels();
String existingLambdaDockerFlags = getEnvMap().get("LAMBDA_DOCKER_FLAGS");
if (existingLambdaDockerFlags != null) {
lambdaDockerFlags = existingLambdaDockerFlags + " " + lambdaDockerFlags;
private String configureServiceContainerLabels(String existingEnvFlagKey) {
String internalMarkerFlags = internalMarkerLabels();
String existingFlags = getEnvMap().get(existingEnvFlagKey);
if (existingFlags != null) {
internalMarkerFlags = existingFlags + " " + internalMarkerFlags;
}
return "\"" + lambdaDockerFlags + "\"";
return "\"" + internalMarkerFlags + "\"";
}

/**
Expand Down

0 comments on commit 39ff5f8

Please sign in to comment.