Skip to content

Commit

Permalink
Merge branch 'main' into fix/issue-9410
Browse files Browse the repository at this point in the history
  • Loading branch information
maximevw authored Dec 1, 2024
2 parents 214c023 + 7a9d09b commit d8fe2f3
Show file tree
Hide file tree
Showing 80 changed files with 871 additions and 396 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ body:
- Timeplus
- ToxiProxy
- Trino
- Typesense
- Vault
- Weaviate
- YugabyteDB
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/enhancement.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ body:
- Timeplus
- ToxiProxy
- Trino
- Typesense
- Vault
- Weaviate
- YugabyteDB
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ body:
- Timeplus
- ToxiProxy
- Trino
- Typesense
- Vault
- Weaviate
- YugabyteDB
Expand Down
3 changes: 1 addition & 2 deletions .github/actions/setup-gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ runs:
using: "composite"
steps:
- name: Setup Gradle Build Action
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-includes: |
caches
notifications
jdks
gradle-home-cache-cleanup: true
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ updates:
schedule:
interval: "weekly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
directory: "/modules/typesense"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
directory: "/modules/vault"
schedule:
Expand Down
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@
- changed-files:
- any-glob-to-any-file:
- modules/trino/**/*
"modules/typesense":
- changed-files:
- any-glob-to-any-file:
- modules/typesense/**/*
"modules/vault":
- changed-files:
- any-glob-to-any-file:
Expand Down
3 changes: 3 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ labels:
- name: modules/trino
color: '#006b75'

- name: modules/typesense
color: '#006b75'

- name: modules/vault
color: '#006b75'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-rootless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Remove Docket root socket
run: sudo rm -rf /var/run/docker.sock
- name: Setup Gradle Build Action
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew --no-daemon --scan testcontainers:test --tests '*GenericContainerRuleTest'
- uses: ./.github/actions/setup-junit-report
3 changes: 3 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ concurrency:
permissions:
contents: read

env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

jobs:
main:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-java
- name: Setup Gradle Build Action
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
- id: set-matrix
env:
# Since we override the tests executor,
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-java
- name: Setup Gradle Build Action
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
- id: set-matrix
working-directory: ./examples/
env:
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-java
- name: Setup Gradle Build Action
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
- id: set-matrix
env:
# Since we override the tests executor,
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/moby-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
# nightly build, at 23:59 CEST
- cron: '59 23 * * *'

env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

jobs:
test_docker:
strategy:
Expand Down Expand Up @@ -50,7 +53,7 @@ jobs:
{
"tc_project": "testcontainers-java",
"tc_docker_install_type": "${{ matrix.install-docker-type }}",
"tc_github_action_url": "${{ GITHUB_SERVER_URL }}/${{ GITHUB_REPOSITORY }}/actions/runs/${{ GITHUB_RUN_ID }}/job/${{ GITHUB_RUN_NUMBER }}",
"tc_github_action_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}",
"tc_github_action_status": "FAILED",
"tc_slack_channel_id": "${{ secrets.SLACK_DOCKER_LATEST_CHANNEL_ID }}"
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: docker image prune -af

- name: Setup Gradle Build Action
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Run Gradle Build
run: ./gradlew build --scan --no-daemon -i -x test
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.testcontainers/testcontainers/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.testcontainers/testcontainers)

[![Netlify Status](https://api.netlify.com/api/v1/badges/189f28a2-7faa-42ff-b03c-738142079cc9/deploy-status)](https://app.netlify.com/sites/testcontainers/deploys)

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=33816473&machine=standardLinux32gb&devcontainer_path=.devcontainer%2Fdevcontainer.json&location=EastUs)

[![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.testcontainers.org/scans)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {

plugins {
id 'io.franzbecker.gradle-lombok' version '5.0.0'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.gradleup.shadow' version '8.3.0'
id 'me.champeau.gradle.japicmp' version '0.4.3' apply false
id 'com.diffplug.spotless' version '6.13.0' apply false
}
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.gradleup.shadow'

description = "Testcontainers Core"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ private void tryStart() {
} else {
logger().error("There are no stdout/stderr logs available for the failed container");
}
stop();
}

throw new ContainerLaunchException("Could not create/start container", e);
Expand Down Expand Up @@ -622,7 +623,14 @@ private void connectToPortForwardingNetwork(String networkMode) {
.map(ContainerNetwork::getNetworkID)
.ifPresent(networkId -> {
if (!Arrays.asList(networkId, "none", "host").contains(networkMode)) {
dockerClient.connectToNetworkCmd().withContainerId(containerId).withNetworkId(networkId).exec();
com.github.dockerjava.api.model.Network network =
this.dockerClient.inspectNetworkCmd().withNetworkId(networkId).exec();
if (!network.getContainers().containsKey(this.containerId)) {
this.dockerClient.connectToNetworkCmd()
.withContainerId(this.containerId)
.withNetworkId(networkId)
.exec();
}
}
});
}
Expand Down Expand Up @@ -826,7 +834,7 @@ private void applyConfiguration(CreateContainerCmd createCommand) {
withExtraHost(INTERNAL_HOST_HOSTNAME, it.getIpAddress());
});

String[] extraHostsArray = extraHosts.stream().toArray(String[]::new);
String[] extraHostsArray = extraHosts.stream().distinct().toArray(String[]::new);
createCommand.withExtraHosts(extraHostsArray);

if (workingDirectory != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ protected Object constructObject(Node node) {

private void parseAndValidate() {
final Map<String, ?> servicesMap;
if (composeFileContent.containsKey("version")) {
if ("2.0".equals(composeFileContent.get("version"))) {
log.warn(
"Testcontainers may not be able to clean up networks spawned using Docker Compose v2.0 files. " +
"Please see https://github.com/testcontainers/moby-ryuk/issues/2, and specify 'version: \"2.1\"' or " +
"higher in {}",
composeFileName
);
}
if (composeFileContent.containsKey("version") && "2.0".equals(composeFileContent.get("version"))) {
log.warn(
"Testcontainers may not be able to clean up networks spawned using Docker Compose v2.0 files. " +
"Please see https://github.com/testcontainers/moby-ryuk/issues/2, and specify 'version: \"2.1\"' or " +
"higher in {}",
composeFileName
);
}

if (composeFileContent.containsKey("services")) {
final Object servicesElement = composeFileContent.get("services");
if (servicesElement == null) {
log.debug(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketTimeoutException;
import java.net.URI;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
Expand Down Expand Up @@ -207,17 +206,15 @@ protected boolean test() {
}

try (Socket socket = socketProvider.call()) {
Duration timeout = Duration.ofMillis(200);
Awaitility
.await()
.atMost(TestcontainersConfiguration.getInstance().getClientPingTimeout(), TimeUnit.SECONDS)
.pollInterval(timeout)
.atMost(TestcontainersConfiguration.getInstance().getClientPingTimeout(), TimeUnit.SECONDS) // timeout after configured duration
.pollInterval(Duration.ofMillis(200)) // check state every 200ms
.pollDelay(Duration.ofSeconds(0)) // start checking immediately
.ignoreExceptionsInstanceOf(SocketTimeoutException.class)
.untilAsserted(() -> socket.connect(socketAddress, (int) timeout.toMillis()));
.untilAsserted(() -> socket.connect(socketAddress));
return true;
} catch (Exception e) {
log.warn("DOCKER_HOST {} is not listening", dockerHost);
log.warn("DOCKER_HOST {} is not listening", dockerHost, e);
return false;
}
}
Expand Down
Loading

0 comments on commit d8fe2f3

Please sign in to comment.