Skip to content

Commit

Permalink
Upgrade testcontainers (#261)
Browse files Browse the repository at this point in the history
Signed-off-by: Hongxin Liang <[email protected]>
  • Loading branch information
honnix authored Oct 16, 2023
1 parent eb684d7 commit 73c6c71
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class FlyteSandboxClient {
public static FlyteSandboxClient create() {
String version = String.valueOf(System.currentTimeMillis());

String address = FlyteSandboxContainer.INSTANCE.getContainerIpAddress();
String address = FlyteSandboxContainer.INSTANCE.getHost();
int port = FlyteSandboxContainer.INSTANCE.getMappedPort(30081);

ManagedChannel channel =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ private static void startContainer() {
IOUtils.copy(imageInputStream, outputStream);
}

// for some reason, when running on Mac, the above copied file is not fully ready after the
// stream being closed; sleeping a little bit could work around that
Thread.sleep(1000);

ExecResult execResult =
INSTANCE.execInContainer(
"docker", "load", "-i", "integration-tests/target/jflyte.tar.gz");
Expand Down Expand Up @@ -106,9 +110,8 @@ public void start() {

logger().info("Flyte is ready!");

String consoleUri =
String.format("http://%s:%d/console", getContainerIpAddress(), getMappedPort(30081));
String k8sUri = String.format("http://%s:%d", getContainerIpAddress(), getMappedPort(30082));
String consoleUri = String.format("http://%s:%d/console", getHost(), getMappedPort(30081));
String k8sUri = String.format("http://%s:%d", getHost(), getMappedPort(30082));

logger().info("Flyte UI is available at " + consoleUri);
logger().info("K8s dashboard is available at " + k8sUri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.junit.rules.ExternalResource;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.Network;
import org.testcontainers.utility.ResourceReaper;

// see https://github.com/testcontainers/testcontainers-java/issues/3081

Expand Down Expand Up @@ -79,7 +78,7 @@ protected void after() {
@Override
public void close() {
if (initialized.getAndSet(false)) {
ResourceReaper.instance().removeNetworkById(NAME);
DockerClientFactory.instance().client().removeNetworkCmd(NAME).exec();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.testcontainers.containers.localstack.LocalStackContainer.Service.S3;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.util.IOUtils;
Expand Down Expand Up @@ -52,8 +55,12 @@ public class S3FileSystemIT {
public void setUp() {
s3 =
AmazonS3ClientBuilder.standard()
.withEndpointConfiguration(localStack.getEndpointConfiguration(S3))
.withCredentials(localStack.getDefaultCredentialsProvider())
.withEndpointConfiguration(
new EndpointConfiguration(
localStack.getEndpointOverride(S3).toString(), localStack.getRegion()))
.withCredentials(
new AWSStaticCredentialsProvider(
new BasicAWSCredentials(localStack.getAccessKey(), localStack.getSecretKey())))
.build();

s3.createBucket("flyteorg");
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.8.0</version>
<version>5.12.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
Expand All @@ -400,7 +400,7 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>1.15.3</version>
<version>1.19.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down

0 comments on commit 73c6c71

Please sign in to comment.