Skip to content

Commit

Permalink
Merge branch 'main' into adding-k6-module
Browse files Browse the repository at this point in the history
  • Loading branch information
javaducky committed Feb 20, 2024
2 parents c19c2e5 + 2c5244d commit 7649f91
Show file tree
Hide file tree
Showing 24 changed files with 359 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Expand Up @@ -17,6 +17,7 @@ body:
- ActiveMQ
- Azure
- Cassandra
- ChromaDB
- Clickhouse
- CockroachDB
- Consul
Expand Down Expand Up @@ -56,6 +57,7 @@ body:
- ToxiProxy
- Trino
- Vault
- Weaviate
- YugabyteDB
validations:
required: true
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement.yaml
Expand Up @@ -17,6 +17,7 @@ body:
- ActiveMQ
- Azure
- Cassandra
- ChromaDB
- Clickhouse
- CockroachDB
- Consul
Expand Down Expand Up @@ -56,6 +57,7 @@ body:
- ToxiProxy
- Trino
- Vault
- Weaviate
- YugabyteDB
validations:
required: true
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yaml
Expand Up @@ -17,6 +17,7 @@ body:
- ActiveMQ
- Azure
- Cassandra
- ChromaDB
- Clickhouse
- CockroachDB
- CrateDB
Expand Down Expand Up @@ -56,6 +57,7 @@ body:
- ToxiProxy
- Trino
- Vault
- Weaviate
- YugabyteDB
- New Module
- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-gradle/action.yml
Expand Up @@ -4,7 +4,7 @@ runs:
using: "composite"
steps:
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-includes: |
caches
Expand Down
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Expand Up @@ -51,6 +51,11 @@ updates:
ignore:
- dependency-name: "io.dropwizard.metrics:metrics-core"
update-types: [ "version-update:semver-major" ]
- package-ecosystem: "gradle"
directory: "/modules/chromadb"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
directory: "/modules/clickhouse"
schedule:
Expand Down Expand Up @@ -310,6 +315,11 @@ updates:
schedule:
interval: "weekly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
directory: "/modules/weaviate"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
directory: "/modules/yugabytedb"
schedule:
Expand Down
8 changes: 8 additions & 0 deletions .github/labeler.yml
Expand Up @@ -27,6 +27,10 @@
- changed-files:
- any-glob-to-any-file:
- modules/cassandra/**/*
"modules/chromadb":
- changed-files:
- any-glob-to-any-file:
- modules/chromadb/**/*
"modules/clickhouse":
- changed-files:
- any-glob-to-any-file:
Expand Down Expand Up @@ -196,6 +200,10 @@
- changed-files:
- any-glob-to-any-file:
- modules/vault/**/*
"modules/weaviate":
- changed-files:
- any-glob-to-any-file:
- modules/weaviate/**/*
"modules/yugabytedb":
- changed-files:
- any-glob-to-any-file:
Expand Down
6 changes: 6 additions & 0 deletions .github/settings.yml
Expand Up @@ -115,6 +115,9 @@ labels:
- name: modules/cassandra
color: '#006b75'

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

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

Expand Down Expand Up @@ -238,6 +241,9 @@ labels:
- name: modules/vault
color: '#006b75'

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

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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-rootless.yml
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/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
- name: Build with Gradle
run: ./gradlew --no-daemon --scan testcontainers:test --tests '*GenericContainerRuleTest'
- uses: ./.github/actions/setup-junit-report
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Expand Up @@ -87,7 +87,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-java
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
- id: set-matrix
env:
# Since we override the tests executor,
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-java
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
- id: set-matrix
working-directory: ./examples/
env:
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-java
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
- id: set-matrix
env:
# Since we override the tests executor,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Expand Up @@ -21,7 +21,7 @@ jobs:
run: docker image prune -af

- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3

- name: Run Gradle Build
run: ./gradlew build --scan --no-daemon -i -x test
Expand Down
4 changes: 2 additions & 2 deletions core/build.gradle
Expand Up @@ -88,8 +88,8 @@ dependencies {

shaded 'org.awaitility:awaitility:4.2.0'

api platform('com.github.docker-java:docker-java-bom:3.3.4')
shaded platform('com.github.docker-java:docker-java-bom:3.3.4')
api platform('com.github.docker-java:docker-java-bom:3.3.5')
shaded platform('com.github.docker-java:docker-java-bom:3.3.5')

api "com.github.docker-java:docker-java-api"

Expand Down
30 changes: 30 additions & 0 deletions docs/modules/chromadb.md
@@ -0,0 +1,30 @@
# ChromaDB

Testcontainers module for [ChromaDB](https://registry.hub.docker.com/r/chromadb/chroma)

## ChromaDB's usage examples

You can start a ChromaDB container instance from any Java application by using:

<!--codeinclude-->
[Default ChromaDB container](../../modules/chromadb/src/test/java/org/testcontainers/chromadb/ChromaDBContainerTest.java) inside_block:container
<!--/codeinclude-->

## Adding this module to your project dependencies

Add the following dependency to your `pom.xml`/`build.gradle` file:

=== "Gradle"
```groovy
testImplementation "org.testcontainers:chromadb:{{latest_version}}"
```

=== "Maven"
```xml
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>chromadb</artifactId>
<version>{{latest_version}}</version>
<scope>test</scope>
</dependency>
```
22 changes: 22 additions & 0 deletions docs/modules/databases/postgres.md
Expand Up @@ -2,6 +2,28 @@

See [Database containers](./index.md) for documentation and usage that is common to all relational database container types.

## Compatible images

`PostgreSQLContainer` can also be used with the following images:

* [pgvector/pgvector](https://hub.docker.com/r/pgvector/pgvector)

<!--codeinclude-->
[Using pgvector](../../../modules/postgresql/src/test/java/org/testcontainers/containers/CompatibleImageTest.java) inside_block:pgvectorContainer
<!--/codeinclude-->

* [postgis/postgis](https://registry.hub.docker.com/r/postgis/postgis)

<!--codeinclude-->
[Using PostGIS](../../../modules/postgresql/src/test/java/org/testcontainers/containers/CompatibleImageTest.java) inside_block:postgisContainer
<!--/codeinclude-->

* [timescale/timescaledb](https://hub.docker.com/r/timescale/timescaledb)

<!--codeinclude-->
[Using TimescaleDB](../../../modules/postgresql/src/test/java/org/testcontainers/containers/CompatibleImageTest.java) inside_block:timescaledbContainer
<!--/codeinclude-->

## Adding this module to your project dependencies

Add the following dependency to your `pom.xml`/`build.gradle` file:
Expand Down
30 changes: 30 additions & 0 deletions docs/modules/weaviate.md
@@ -0,0 +1,30 @@
# Weaviate

Testcontainers module for [Weaviate](https://hub.docker.com/r/semitechnologies/weaviate)

## WeaviateContainer's usage examples

You can start a Weaviate container instance from any Java application by using:

<!--codeinclude-->
[Default Weaviate container](../../modules/weaviate/src/test/java/org/testcontainers/weaviate/WeaviateContainerTest.java) inside_block:container
<!--/codeinclude-->

## Adding this module to your project dependencies

Add the following dependency to your `pom.xml`/`build.gradle` file:

=== "Gradle"
```groovy
testImplementation "org.testcontainers:weaviate:{{latest_version}}"
```

=== "Maven"
```xml
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>weaviate</artifactId>
<version>{{latest_version}}</version>
<scope>test</scope>
</dependency>
```
2 changes: 2 additions & 0 deletions mkdocs.yml
Expand Up @@ -75,6 +75,7 @@ nav:
- modules/databases/yugabytedb.md
- modules/activemq.md
- modules/azure.md
- modules/chromadb.md
- modules/consul.md
- modules/docker_compose.md
- modules/elasticsearch.md
Expand All @@ -94,6 +95,7 @@ nav:
- modules/solr.md
- modules/toxiproxy.md
- modules/vault.md
- modules/weaviate.md
- modules/webdriver_containers.md
- Test framework integration:
- test_framework_integration/junit_4.md
Expand Down
8 changes: 8 additions & 0 deletions modules/chromadb/build.gradle
@@ -0,0 +1,8 @@
description = "Testcontainers :: ChromaDB"

dependencies {
api project(':testcontainers')

testImplementation 'org.assertj:assertj-core:3.25.1'
testImplementation 'io.rest-assured:rest-assured:5.4.0'
}
@@ -0,0 +1,34 @@
package org.testcontainers.chromadb;

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;

/**
* Testcontainers implementation of ChromaDB.
* <p>
* Supported images: {@code chromadb/chroma}, {@code ghcr.io/chroma-core/chroma}
* <p>
* Exposed ports: 8000
*/
public class ChromaDBContainer extends GenericContainer<ChromaDBContainer> {

private static final DockerImageName DEFAULT_DOCKER_IMAGE = DockerImageName.parse("chromadb/chroma");

private static final DockerImageName GHCR_DOCKER_IMAGE = DockerImageName.parse("ghcr.io/chroma-core/chroma");

public ChromaDBContainer(String dockerImageName) {
this(DockerImageName.parse(dockerImageName));
}

public ChromaDBContainer(DockerImageName dockerImageName) {
super(dockerImageName);
dockerImageName.assertCompatibleWith(DEFAULT_DOCKER_IMAGE, GHCR_DOCKER_IMAGE);
withExposedPorts(8000);
waitingFor(Wait.forHttp("/api/v1/heartbeat"));
}

public String getEndpoint() {
return "http://" + getHost() + ":" + getFirstMappedPort();
}
}
@@ -0,0 +1,30 @@
package org.testcontainers.chromadb;

import io.restassured.http.ContentType;
import org.junit.Test;

import static io.restassured.RestAssured.given;

public class ChromaDBContainerTest {

@Test
public void test() {
try ( // container {
ChromaDBContainer chroma = new ChromaDBContainer("chromadb/chroma:0.4.22")
// }
) {
chroma.start();

given()
.baseUri(chroma.getEndpoint())
.when()
.body("{\"name\": \"test\"}")
.contentType(ContentType.JSON)
.post("/api/v1/databases")
.then()
.statusCode(200);

given().baseUri(chroma.getEndpoint()).when().get("/api/v1/databases/test").then().statusCode(200);
}
}
}
16 changes: 16 additions & 0 deletions modules/chromadb/src/test/resources/logback-test.xml
@@ -0,0 +1,16 @@
<configuration>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>

<logger name="org.testcontainers" level="INFO"/>
</configuration>

0 comments on commit 7649f91

Please sign in to comment.