Skip to content

Commit

Permalink
avniproject/avni-infra#41 | Fix tests for postgres16 server
Browse files Browse the repository at this point in the history
  • Loading branch information
himeshr committed Nov 5, 2024
1 parent d052b6a commit 28d49cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ _build_db:
-psql -h $(dbServer) -p $(dbPort) -U ${su} -d $(database) -c 'create extension if not exists "ltree"';
-psql -h $(dbServer) -p $(dbPort) -U ${su} -d $(database) -c 'create extension if not exists "hstore"';
-psql -h $(dbServer) -p $(dbPort) -U ${su} -d postgres -c 'create role demo with NOINHERIT NOLOGIN';
-psql -h $(dbServer) -p $(dbPort) -U ${su} -d postgres -c 'grant demo to openchs';
-psql -h $(dbServer) -p $(dbPort) -U ${su} -d postgres -c 'grant demo to openchs WITH ADMIN OPTION';
-psql -h $(dbServer) -p $(dbPort) -U ${su} -d postgres -c 'create role openchs_impl';
-psql -h $(dbServer) -p $(dbPort) -U ${su} -d postgres -c 'grant openchs_impl to openchs';
-psql -h $(dbServer) -p $(dbPort) -U ${su} -d postgres -c 'grant openchs_impl to openchs WITH ADMIN OPTION';
-psql -h $(dbServer) -p $(dbPort) -U ${su} -d postgres -c 'create role organisation_user createrole admin openchs_impl';
# </postgres>

Expand Down Expand Up @@ -148,6 +148,10 @@ test-server: test_server
test_server_quick_without_clean_rebuild: ## Run tests
MAVEN_OPTS="-Xmx3200m" ./gradlew test

test_server_with_remote_db_quick_with_rebuild:
make rebuild_testdb su=$(DBUSER) dbServer=$(DBSERVER) dbPort=$(DBPORT)
OPENCHS_DATABASE_URL=jdbc:postgresql://$(DBSERVER):$(DBPORT)/openchs_test GRADLE_OPTS="-Xmx3200m" ./gradlew clean build test

test_server_with_remote_db:
make rebuild_testdb su=$(DBUSER) dbServer=$(DBSERVER)
OPENCHS_DATABASE_URL=jdbc:postgresql://$(DBSERVER):5432/openchs_test GRADLE_OPTS="-Xmx256m" ./gradlew clean test
Expand Down
8 changes: 3 additions & 5 deletions avni-server-api/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ avni.defaultUserName=${OPENCHS_USER_NAME:admin}
avni.environment=test
spring.servlet.multipart.max-file-size=10028KB
spring.servlet.multipart.max-request-size=10028KB

avni.database=${OPENCHS_DATABASE:openchs}
avni.database.port=${OPENCHS_DATABASE_PORT:5432}
avni.database.server=${OPENCHS_DATABASE_SERVER:localhost}
spring.datasource.url=${OPENCHS_DATABASE_URL:jdbc:postgresql://${avni.database.server}:5432/openchs_test}
spring.datasource.username=openchs
spring.datasource.password=password
spring.datasource.url=${OPENCHS_DATABASE_URL:jdbc:postgresql://${avni.database.server}:${avni.database.port}/openchs_test}
spring.datasource.username=${OPENCHS_DATABASE_USER:openchs}
spring.datasource.password=${OPENCHS_DATABASE_PASSWORD:password}
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource
spring.datasource.tomcat.testWhileIdle=true
spring.datasource.tomcat.validationQuery=SELECT 1
spring.datasource.tomcat.jdbc-interceptors=org.avni.server.framework.tomcat.SetOrganisationJdbcInterceptor
spring.flyway.schemas=public
spring.flyway.baseline-on-migrate=false

#Tomcat
server.tomcat.accesslog.max-days=90

Expand Down

0 comments on commit 28d49cc

Please sign in to comment.