Skip to content

Commit

Permalink
fix: Update java testcontainers to use Compose V2 (feast-dev#4381)
Browse files Browse the repository at this point in the history
* fix: revert java testcontainers to use docker-based compose

Signed-off-by: tokoko <togurgenidze@gmail.com>

* fix: update testcontainers-java to Compose v2

Signed-off-by: tokoko <togurgenidze@gmail.com>

---------

Signed-off-by: tokoko <togurgenidze@gmail.com>
Co-authored-by: tokoko <togurgenidze@gmail.com>
  • Loading branch information
tokoko and tokoko authored Aug 6, 2024
1 parent 67a63d9 commit 9a33fce
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 16 deletions.
13 changes: 13 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM mcr.microsoft.com/vscode/devcontainers/python:3.9-buster

USER vscode
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
RUN curl -fsSL https://pixi.sh/install.sh | bash
ENV PATH=$PATH:/home/vscode/.cargo/bin
ENV PYTHON=3.9
RUN uv venv ~/.local
ENV VIRTUAL_ENV=~/.local
ENV PATH=$VIRTUAL_ENV/bin:$PATH
USER root


42 changes: 31 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "feast-devcontainer",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest"
},
"ghcr.io/devcontainers/features/python:1": {
"version": "3.9"
}
},
"postCreateCommand": "pip install -e '.[dev]' && make compile-protos-python"
"name": "feast-devcontainer",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "Dockerfile"
},

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest"
},
"ghcr.io/devcontainers-contrib/features/maven-sdkman:2": {
"jdkVersion": "11.0.24-amzn"
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "make install-python-ci-dependencies-uv-venv"

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
10 changes: 8 additions & 2 deletions java/serving/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,21 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.16.2</version>
<version>1.20.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.16.2</version>
<version>1.20.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.testcontainers.containers.DockerComposeContainer;
import org.testcontainers.containers.ComposeContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Testcontainers;

@Testcontainers
abstract class ServingEnvironment {
static DockerComposeContainer environment;
static ComposeContainer environment;
static int serverPort = getFreePort();
ServingServiceGrpc.ServingServiceBlockingStub servingStub;
Injector injector;
Expand All @@ -57,7 +57,7 @@ abstract class ServingEnvironment {
@BeforeAll
static void globalSetup() {
environment =
new DockerComposeContainer(
new ComposeContainer(
new File("src/test/resources/docker-compose/docker-compose-redis-it.yml"))
.withExposedService("redis", 6379)
.withExposedService(
Expand Down

0 comments on commit 9a33fce

Please sign in to comment.