From bac742fe816a349d75db28fc44e5cca22776bb1a Mon Sep 17 00:00:00 2001 From: Szymon Szukalski Date: Thu, 25 Jul 2024 10:36:15 +1000 Subject: Use in-memory database (H2) for tests --- src/main/resources/application.properties | 6 +++--- src/test/resources/application-test.properties | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/application-test.properties (limited to 'src') diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 42e8f9a..3600371 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,12 +1,12 @@ spring.application.name=markr - # PostgreSQL Configuration spring.datasource.url=jdbc:postgresql://localhost:5432/markr spring.datasource.username=markr_prod spring.datasource.password=CpfzDA3nR3jH9Ky4 spring.datasource.driver-class-name=org.postgresql.Driver - # Hibernate Configuration spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=false \ No newline at end of file +spring.jpa.show-sql=false +# Disable Open Session in View +spring.jpa.open-in-view=false \ No newline at end of file diff --git a/src/test/resources/application-test.properties b/src/test/resources/application-test.properties new file mode 100644 index 0000000..87666a1 --- /dev/null +++ b/src/test/resources/application-test.properties @@ -0,0 +1,12 @@ +# H2 Configuration +spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=markr_test +spring.datasource.password=DekqFAQnRIjH2Kz1 +spring.h2.console.enabled=true +# Hibernate Configuration +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=false +# Disable Open Session in View +spring.jpa.open-in-view=false \ No newline at end of file -- cgit v1.2.3