Skip to content

Commit

Permalink
#1199 - trigger build
Browse files Browse the repository at this point in the history
  • Loading branch information
Duy Le Van committed Oct 21, 2024
1 parent 94dca71 commit 4be1341
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
15 changes: 15 additions & 0 deletions common-library/src/it/java/common/container/ContainerFactory.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package common.container;

import dasniko.testcontainers.keycloak.KeycloakContainer;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.utility.DockerImageName;

/**
Expand Down Expand Up @@ -44,4 +47,16 @@ public static KafkaContainer kafkaContainer(DynamicPropertyRegistry registry, St
return kafkaContainer;
}

public static PostgreSQLContainer pgvector(DynamicPropertyRegistry registry, String version) {
var image = DockerImageName.parse("pgvector/pgvector:%s".formatted(version))
.asCompatibleSubstituteFor("postgres");
var postgres = new PostgreSQLContainer<>(image);
postgres.start();

registry.add("spring.datasource.url", postgres::getJdbcUrl);
registry.add("spring.datasource.username", postgres::getUsername);
registry.add("spring.datasource.password", postgres::getPassword);
return postgres;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ public KafkaContainer kafkaContainer(DynamicPropertyRegistry registry) {

@Bean
@ServiceConnection
public PostgreSQLContainer pgvector(DynamicPropertyRegistry registry) {
var image = DockerImageName.parse("pgvector/pgvector:pg16")
.asCompatibleSubstituteFor("postgres");
var postgres = new PostgreSQLContainer<>(image);
postgres.start();

registry.add("spring.datasource.url", postgres::getJdbcUrl);
registry.add("spring.datasource.username", postgres::getUsername);
registry.add("spring.datasource.password", postgres::getPassword);
return postgres;
public PostgreSQLContainer pgvectorContainer(DynamicPropertyRegistry registry) {
return ContainerFactory.pgvector(registry, "pg16");
}
}

0 comments on commit 4be1341

Please sign in to comment.