Skip to content

Commit

Permalink
fix: deprecated calls in testcontainers
Browse files Browse the repository at this point in the history
  • Loading branch information
Simoffsky committed Feb 15, 2025
1 parent dbbf369 commit 86005f5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
3 changes: 1 addition & 2 deletions vectorstores/chroma/chroma_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
chromatypes "github.com/amikos-tech/chroma-go/types"
"github.com/google/uuid"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
tcchroma "github.com/testcontainers/testcontainers-go/modules/chroma"
"github.com/tmc/langchaingo/chains"
"github.com/tmc/langchaingo/embeddings"
Expand Down Expand Up @@ -569,7 +568,7 @@ func getValues(t *testing.T) (string, string) {

chromaURL := os.Getenv(chroma.ChromaURLKeyEnvVarName)
if chromaURL == "" {
chromaContainer, err := tcchroma.RunContainer(context.Background(), testcontainers.WithImage("chromadb/chroma:0.4.24"))
chromaContainer, err := tcchroma.Run(context.Background(), "chromadb/chroma:0.4.24")
if err != nil && strings.Contains(err.Error(), "Cannot connect to the Docker daemon") {
t.Skip("Docker not available")
}
Expand Down
3 changes: 1 addition & 2 deletions vectorstores/milvus/milvus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/milvus-io/milvus-sdk-go/v2/client"
"github.com/milvus-io/milvus-sdk-go/v2/entity"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
tcmilvus "github.com/testcontainers/testcontainers-go/modules/milvus"
"github.com/tmc/langchaingo/embeddings"
"github.com/tmc/langchaingo/llms"
Expand Down Expand Up @@ -46,7 +45,7 @@ func getNewStore(t *testing.T, opts ...Option) (Store, error) {

url := os.Getenv("MILVUS_URL")
if url == "" {
milvusContainer, err := tcmilvus.RunContainer(context.Background(), testcontainers.WithImage("milvusdb/milvus:v2.4.0-rc.1-latest"))
milvusContainer, err := tcmilvus.Run(context.Background(), "milvusdb/milvus:v2.4.0-rc.1-latest")
if err != nil && strings.Contains(err.Error(), "Cannot connect to the Docker daemon") {
t.Skip("Docker not available")
}
Expand Down
3 changes: 1 addition & 2 deletions vectorstores/opensearch/opensearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/google/uuid"
opensearchgo "github.com/opensearch-project/opensearch-go"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
tcopensearch "github.com/testcontainers/testcontainers-go/modules/opensearch"
"github.com/tmc/langchaingo/chains"
"github.com/tmc/langchaingo/embeddings"
Expand All @@ -33,7 +32,7 @@ func getEnvVariables(t *testing.T) (string, string, string) {

opensearchEndpoint := os.Getenv("OPENSEARCH_ENDPOINT")
if opensearchEndpoint == "" {
openseachContainer, err := tcopensearch.RunContainer(context.Background(), testcontainers.WithImage("opensearchproject/opensearch:2.11.1"))
openseachContainer, err := tcopensearch.Run(context.Background(), "opensearchproject/opensearch:2.11.1")
if err != nil && strings.Contains(err.Error(), "Cannot connect to the Docker daemon") {
t.Skip("Docker not available")
}
Expand Down
4 changes: 2 additions & 2 deletions vectorstores/pgvector/pgvector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func preCheckEnvSetting(t *testing.T) string {

pgvectorURL := os.Getenv("PGVECTOR_CONNECTION_STRING")
if pgvectorURL == "" {
pgVectorContainer, err := tcpostgres.RunContainer(
pgVectorContainer, err := tcpostgres.Run(
context.Background(),
testcontainers.WithImage("docker.io/pgvector/pgvector:pg16"),
"docker.io/pgvector/pgvector:pg16",
tcpostgres.WithDatabase("db_test"),
tcpostgres.WithUsername("user"),
tcpostgres.WithPassword("passw0rd!"),
Expand Down
3 changes: 1 addition & 2 deletions vectorstores/qdrant/qdrant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/google/uuid"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
tcqdrant "github.com/testcontainers/testcontainers-go/modules/qdrant"
"github.com/tmc/langchaingo/chains"
"github.com/tmc/langchaingo/embeddings"
Expand Down Expand Up @@ -365,7 +364,7 @@ func getValues(t *testing.T) (string, string, int, string) {

qdrantURL := os.Getenv("QDRANT_URL")
if qdrantURL == "" {
qdrantContainer, err := tcqdrant.RunContainer(context.Background(), testcontainers.WithImage("qdrant/qdrant:v1.7.4"))
qdrantContainer, err := tcqdrant.Run(context.Background(), "qdrant/qdrant:v1.7.4")
if err != nil && strings.Contains(err.Error(), "Cannot connect to the Docker daemon") {
t.Skip("Docker not available")
}
Expand Down
3 changes: 1 addition & 2 deletions vectorstores/weaviate/weaviate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/google/uuid"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
tcweaviate "github.com/testcontainers/testcontainers-go/modules/weaviate"
"github.com/tmc/langchaingo/chains"
"github.com/tmc/langchaingo/embeddings"
Expand All @@ -26,7 +25,7 @@ func getValues(t *testing.T) (string, string) {
scheme := os.Getenv("WEAVIATE_SCHEME")
host := os.Getenv("WEAVIATE_HOST")
if scheme == "" || host == "" {
weaviateContainer, err := tcweaviate.RunContainer(context.Background(), testcontainers.WithImage("semitechnologies/weaviate:1.25.4"))
weaviateContainer, err := tcweaviate.Run(context.Background(), "semitechnologies/weaviate:1.25.4")
if err != nil && strings.Contains(err.Error(), "Cannot connect to the Docker daemon") {
t.Skip("Docker not available")
}
Expand Down

0 comments on commit 86005f5

Please sign in to comment.