Skip to content

Commit 9a33fce

Browse files
authored
fix: Update java testcontainers to use Compose V2 (#4381)
* 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>
1 parent 67a63d9 commit 9a33fce

File tree

4 files changed

+55
-16
lines changed

4 files changed

+55
-16
lines changed

.devcontainer/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM mcr.microsoft.com/vscode/devcontainers/python:3.9-buster
2+
3+
USER vscode
4+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
5+
RUN curl -fsSL https://pixi.sh/install.sh | bash
6+
ENV PATH=$PATH:/home/vscode/.cargo/bin
7+
ENV PYTHON=3.9
8+
RUN uv venv ~/.local
9+
ENV VIRTUAL_ENV=~/.local
10+
ENV PATH=$VIRTUAL_ENV/bin:$PATH
11+
USER root
12+
13+

.devcontainer/devcontainer.json

+31-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
13
{
2-
"name": "feast-devcontainer",
3-
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
4-
"features": {
5-
"ghcr.io/devcontainers/features/docker-in-docker:2": {
6-
"version": "latest"
7-
},
8-
"ghcr.io/devcontainers/features/python:1": {
9-
"version": "3.9"
10-
}
11-
},
12-
"postCreateCommand": "pip install -e '.[dev]' && make compile-protos-python"
4+
"name": "feast-devcontainer",
5+
"build": {
6+
// Sets the run context to one level up instead of the .devcontainer folder.
7+
"context": "..",
8+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
9+
"dockerfile": "Dockerfile"
10+
},
11+
12+
// Features to add to the dev container. More info: https://containers.dev/features.
13+
"features": {
14+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
15+
"version": "latest"
16+
},
17+
"ghcr.io/devcontainers-contrib/features/maven-sdkman:2": {
18+
"jdkVersion": "11.0.24-amzn"
19+
}
20+
},
21+
22+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
23+
// "forwardPorts": [],
24+
25+
// Uncomment the next line to run commands after the container is created.
26+
"postCreateCommand": "make install-python-ci-dependencies-uv-venv"
27+
28+
// Configure tool-specific properties.
29+
// "customizations": {},
30+
31+
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
32+
// "remoteUser": "root"
1333
}

java/serving/pom.xml

+8-2
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,21 @@
348348
<dependency>
349349
<groupId>org.testcontainers</groupId>
350350
<artifactId>testcontainers</artifactId>
351-
<version>1.16.2</version>
351+
<version>1.20.1</version>
352352
<scope>test</scope>
353353
</dependency>
354354
<dependency>
355355
<groupId>org.testcontainers</groupId>
356356
<artifactId>junit-jupiter</artifactId>
357-
<version>1.16.2</version>
357+
<version>1.20.1</version>
358358
<scope>test</scope>
359359
</dependency>
360+
<dependency>
361+
<groupId>org.junit.jupiter</groupId>
362+
<artifactId>junit-jupiter-api</artifactId>
363+
<version>5.10.3</version>
364+
<scope>test</scope>
365+
</dependency>
360366
<dependency>
361367
<groupId>org.awaitility</groupId>
362368
<artifactId>awaitility</artifactId>

java/serving/src/test/java/feast/serving/it/ServingEnvironment.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
import org.junit.jupiter.api.AfterEach;
4040
import org.junit.jupiter.api.BeforeAll;
4141
import org.junit.jupiter.api.BeforeEach;
42-
import org.testcontainers.containers.DockerComposeContainer;
42+
import org.testcontainers.containers.ComposeContainer;
4343
import org.testcontainers.containers.wait.strategy.Wait;
4444
import org.testcontainers.junit.jupiter.Testcontainers;
4545

4646
@Testcontainers
4747
abstract class ServingEnvironment {
48-
static DockerComposeContainer environment;
48+
static ComposeContainer environment;
4949
static int serverPort = getFreePort();
5050
ServingServiceGrpc.ServingServiceBlockingStub servingStub;
5151
Injector injector;
@@ -57,7 +57,7 @@ abstract class ServingEnvironment {
5757
@BeforeAll
5858
static void globalSetup() {
5959
environment =
60-
new DockerComposeContainer(
60+
new ComposeContainer(
6161
new File("src/test/resources/docker-compose/docker-compose-redis-it.yml"))
6262
.withExposedService("redis", 6379)
6363
.withExposedService(

0 commit comments

Comments
 (0)