-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Postgres Database integration tests added
- Loading branch information
Syed Abdullah
committed
Oct 22, 2024
1 parent
4b17d03
commit 1346aaa
Showing
18 changed files
with
510 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
spring.application.name=demo | ||
|
||
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl | ||
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl | ||
|
||
spring.sql.init.mode=always | ||
spring.test.database.replace=none | ||
spring.datasource.url=jdbc:tc:pgvector/pgvector:pg16:///ecommerce | ||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect | ||
spring.jpa.hibernate.ddl-auto=none | ||
spring.sql.init.data-locations=classpath:postgresdb-schema-with-data.sql | ||
spring.jpa.properties.hibernate.show_sql=true | ||
logging.level.org.hibernate.orm.jdbc.bind=trace | ||
|
||
## Disable liquibase as it contains MySQL schema files | ||
spring.liquibase.enabled=false |
23 changes: 23 additions & 0 deletions
23
src/test/java/syed/abdullah/demo/postgres/integration/AbstractIntegrationTestPostgresDB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package syed.abdullah.demo.postgres.integration; | ||
|
||
import org.junit.jupiter.api.BeforeAll; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.testcontainers.containers.PostgreSQLContainer; | ||
import org.testcontainers.junit.jupiter.Testcontainers; | ||
|
||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
@Testcontainers | ||
@ActiveProfiles("postgresdb") | ||
public abstract class AbstractIntegrationTestPostgresDB { | ||
|
||
//@Container | ||
@ServiceConnection | ||
static PostgreSQLContainer<?> pgvectorDb = new PostgreSQLContainer<>("pgvector/pgvector:pg16"); | ||
|
||
@BeforeAll | ||
static void beforeAll() { | ||
pgvectorDb.start(); | ||
} | ||
} |
Oops, something went wrong.