Skip to content

Commit 2c5244d

Browse files
authored
Add ChromaDB module (#8336)
1 parent f45bb44 commit 2c5244d

File tree

12 files changed

+134
-0
lines changed

12 files changed

+134
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ body:
1717
- ActiveMQ
1818
- Azure
1919
- Cassandra
20+
- ChromaDB
2021
- Clickhouse
2122
- CockroachDB
2223
- Consul

.github/ISSUE_TEMPLATE/enhancement.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ body:
1717
- ActiveMQ
1818
- Azure
1919
- Cassandra
20+
- ChromaDB
2021
- Clickhouse
2122
- CockroachDB
2223
- Consul

.github/ISSUE_TEMPLATE/feature.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ body:
1717
- ActiveMQ
1818
- Azure
1919
- Cassandra
20+
- ChromaDB
2021
- Clickhouse
2122
- CockroachDB
2223
- CrateDB

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ updates:
5151
ignore:
5252
- dependency-name: "io.dropwizard.metrics:metrics-core"
5353
update-types: [ "version-update:semver-major" ]
54+
- package-ecosystem: "gradle"
55+
directory: "/modules/chromadb"
56+
schedule:
57+
interval: "weekly"
58+
open-pull-requests-limit: 10
5459
- package-ecosystem: "gradle"
5560
directory: "/modules/clickhouse"
5661
schedule:

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
- changed-files:
2828
- any-glob-to-any-file:
2929
- modules/cassandra/**/*
30+
"modules/chromadb":
31+
- changed-files:
32+
- any-glob-to-any-file:
33+
- modules/chromadb/**/*
3034
"modules/clickhouse":
3135
- changed-files:
3236
- any-glob-to-any-file:

.github/settings.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ labels:
115115
- name: modules/cassandra
116116
color: '#006b75'
117117

118+
- name: modules/chromadb
119+
color: '#006b75'
120+
118121
- name: modules/clickhouse
119122
color: '#006b75'
120123

docs/modules/chromadb.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# ChromaDB
2+
3+
Testcontainers module for [ChromaDB](https://registry.hub.docker.com/r/chromadb/chroma)
4+
5+
## ChromaDB's usage examples
6+
7+
You can start a ChromaDB container instance from any Java application by using:
8+
9+
<!--codeinclude-->
10+
[Default ChromaDB container](../../modules/chromadb/src/test/java/org/testcontainers/chromadb/ChromaDBContainerTest.java) inside_block:container
11+
<!--/codeinclude-->
12+
13+
## Adding this module to your project dependencies
14+
15+
Add the following dependency to your `pom.xml`/`build.gradle` file:
16+
17+
=== "Gradle"
18+
```groovy
19+
testImplementation "org.testcontainers:chromadb:{{latest_version}}"
20+
```
21+
22+
=== "Maven"
23+
```xml
24+
<dependency>
25+
<groupId>org.testcontainers</groupId>
26+
<artifactId>chromadb</artifactId>
27+
<version>{{latest_version}}</version>
28+
<scope>test</scope>
29+
</dependency>
30+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ nav:
7575
- modules/databases/yugabytedb.md
7676
- modules/activemq.md
7777
- modules/azure.md
78+
- modules/chromadb.md
7879
- modules/consul.md
7980
- modules/docker_compose.md
8081
- modules/elasticsearch.md

modules/chromadb/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
description = "Testcontainers :: ChromaDB"
2+
3+
dependencies {
4+
api project(':testcontainers')
5+
6+
testImplementation 'org.assertj:assertj-core:3.25.1'
7+
testImplementation 'io.rest-assured:rest-assured:5.4.0'
8+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.testcontainers.chromadb;
2+
3+
import org.testcontainers.containers.GenericContainer;
4+
import org.testcontainers.containers.wait.strategy.Wait;
5+
import org.testcontainers.utility.DockerImageName;
6+
7+
/**
8+
* Testcontainers implementation of ChromaDB.
9+
* <p>
10+
* Supported images: {@code chromadb/chroma}, {@code ghcr.io/chroma-core/chroma}
11+
* <p>
12+
* Exposed ports: 8000
13+
*/
14+
public class ChromaDBContainer extends GenericContainer<ChromaDBContainer> {
15+
16+
private static final DockerImageName DEFAULT_DOCKER_IMAGE = DockerImageName.parse("chromadb/chroma");
17+
18+
private static final DockerImageName GHCR_DOCKER_IMAGE = DockerImageName.parse("ghcr.io/chroma-core/chroma");
19+
20+
public ChromaDBContainer(String dockerImageName) {
21+
this(DockerImageName.parse(dockerImageName));
22+
}
23+
24+
public ChromaDBContainer(DockerImageName dockerImageName) {
25+
super(dockerImageName);
26+
dockerImageName.assertCompatibleWith(DEFAULT_DOCKER_IMAGE, GHCR_DOCKER_IMAGE);
27+
withExposedPorts(8000);
28+
waitingFor(Wait.forHttp("/api/v1/heartbeat"));
29+
}
30+
31+
public String getEndpoint() {
32+
return "http://" + getHost() + ":" + getFirstMappedPort();
33+
}
34+
}

0 commit comments

Comments
 (0)