From 28d49cc851c95e2005f799a0c8d05b023e89fc5c Mon Sep 17 00:00:00 2001 From: himeshr Date: Tue, 5 Nov 2024 14:35:15 +0530 Subject: [PATCH] avniproject/avni-infra#41 | Fix tests for postgres16 server --- Makefile | 8 ++++++-- avni-server-api/src/test/resources/application.properties | 8 +++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0d196e7ac..c4501216e 100644 --- a/Makefile +++ b/Makefile @@ -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'; # @@ -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 diff --git a/avni-server-api/src/test/resources/application.properties b/avni-server-api/src/test/resources/application.properties index e9d4180cc..89985b935 100644 --- a/avni-server-api/src/test/resources/application.properties +++ b/avni-server-api/src/test/resources/application.properties @@ -4,13 +4,12 @@ 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 @@ -18,7 +17,6 @@ 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