Skip to content

Commit

Permalink
Add pinecone module
Browse files Browse the repository at this point in the history
  • Loading branch information
eddumelendez committed Jan 30, 2025
1 parent 1404c44 commit 3a27cfa
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 0 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 @@ -50,6 +50,7 @@ body:
- Oracle Free
- Oracle XE
- OrientDB
- Pinecone
- PostgreSQL
- Presto
- Pulsar
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 @@ -50,6 +50,7 @@ body:
- Oracle Free
- Oracle XE
- OrientDB
- Pinecone
- PostgreSQL
- Presto
- Pulsar
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 @@ -50,6 +50,7 @@ body:
- Oracle Free
- Oracle XE
- OrientDB
- Pinecone
- PostgreSQL
- Qdrant
- QuestDB
Expand Down
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ updates:
schedule:
interval: "weekly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
directory: "/modules/pinecone"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
directory: "/modules/pulsar"
schedule:
Expand Down
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@
- changed-files:
- any-glob-to-any-file:
- modules/orientdb/**/*
"modules/pinecone":
- changed-files:
- any-glob-to-any-file:
- modules/pinecone/**/*
"modules/postgres":
- 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 @@ -211,6 +211,9 @@ labels:
- name: modules/orientdb
color: '#006b75'

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

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

Expand Down
30 changes: 30 additions & 0 deletions docs/modules/pinecone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Pinecone

Testcontainers module for [Pinecone](https://github.com/orgs/pinecone-io/packages/container/package/pinecone-local).

## PineconeContainer's usage examples

You can start an Pinecone container instance from any Java application by using:

<!--codeinclude-->
[Pinecone container](../../modules/pinecone/src/test/java/org/testcontainers/pinecone/PineconeContainerTest.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:pinecone:{{latest_version}}"
```

=== "Maven"
```xml
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>pinecone</artifactId>
<version>{{latest_version}}</version>
<scope>test</scope>
</dependency>
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ nav:
- modules/nginx.md
- modules/ollama.md
- modules/openfga.md
- modules/pinecone.md
- modules/pulsar.md
- modules/qdrant.md
- modules/rabbitmq.md
Expand Down
8 changes: 8 additions & 0 deletions modules/pinecone/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
description = "Testcontainers :: ActiveMQ"

dependencies {
api project(':testcontainers')

testImplementation 'org.assertj:assertj-core:3.26.3'
testImplementation 'io.pinecone:pinecone-client:3.1.0'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.testcontainers.pinecone;

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.utility.DockerImageName;

public class PineconeContainer extends GenericContainer<PineconeContainer> {

private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse(
"ghcr.io/pinecone-io/pinecone-local"
);

private static final int PORT = 5080;

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

public PineconeContainer(DockerImageName dockerImageName) {
super(dockerImageName);
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);

withEnv("PORT", String.valueOf(5080));
withExposedPorts(5080);
}

public String getEndpoint() {
return "http://" + getHost() + ":" + getMappedPort(PORT);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.testcontainers.pinecone;

import io.pinecone.clients.Pinecone;
import org.junit.Test;
import org.openapitools.db_control.client.model.DeletionProtection;
import org.openapitools.db_control.client.model.IndexModel;

import static org.assertj.core.api.Assertions.assertThat;

public class PineconeContainerTest {

@Test
public void testSimple() {
try ( // container {
PineconeContainer container = new PineconeContainer("ghcr.io/pinecone-io/pinecone-local:v0.7.0")
// }
) {
container.start();

// client {
Pinecone pinecone = new Pinecone.Builder("pclocal")
.withHost(container.getEndpoint())
.withTlsEnabled(false)
.build();
// }

String indexName = "example-index";
pinecone.createServerlessIndex(indexName, "cosine", 2, "aws", "us-east-1", DeletionProtection.DISABLED);
IndexModel indexModel = pinecone.describeIndex(indexName);
assertThat(indexModel.getDeletionProtection()).isEqualTo(DeletionProtection.DISABLED);
}
}
}
16 changes: 16 additions & 0 deletions modules/pinecone/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -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 3a27cfa

Please sign in to comment.