From 920da2d4f096c17d6111501932568ffee523173f Mon Sep 17 00:00:00 2001 From: Holash Chand Date: Thu, 7 Sep 2023 12:43:33 +0530 Subject: [PATCH] fixed make tests failing --- Makefile | 6 ++---- docker-compose.yml | 6 +++--- .../registry/helper/EntityStateHelper.java | 3 ++- test_environments/test1.env | 11 +++++++++++ test_environments/test2.env | 14 ++++++++++++++ 5 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 test_environments/test1.env create mode 100644 test_environments/test2.env diff --git a/Makefile b/Makefile index e27716e2a..1efc42883 100644 --- a/Makefile +++ b/Makefile @@ -28,12 +28,10 @@ java/registry/target/registry.jar: $(SOURCES) cd java && ./mvnw clean install test: build - @echo "VIEW_DIR=java/apitest/src/test/resources/views" >> .env || echo "no permission to append to file" - @echo "SCHEMA_DIR=java/apitest/src/test/resources/schemas" >> .env || echo "no permission to append to file" @docker-compose down @rm -rf db-data* || echo "no permission to delete" # test with distributed definition manager and native search - @SEARCH_PROVIDER_NAME=dev.sunbirdrc.registry.service.NativeSearchService RELEASE_VERSION=latest KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 MANAGER_TYPE=DistributedDefinitionsManager DB_DIR=db-data-1 docker-compose up -d db keycloak registry certificate-signer certificate-api redis + @docker-compose --env-file test_environments/test1.env up -d db keycloak registry certificate-signer certificate-api redis @echo "Starting the test" && sh build/wait_for_port.sh 8080 @echo "Starting the test" && sh build/wait_for_port.sh 8081 @docker-compose ps @@ -42,7 +40,7 @@ test: build @docker-compose down @rm -rf db-data-1 || echo "no permission to delete" # test with kafka(async), events, notifications, - @NOTIFICATION_ENABLED=true NOTIFICATION_URL=http://notification-ms:8765/notification-service/v1/notification TRACK_NOTIFICATIONS=true EVENT_ENABLED=true ASYNC_ENABLED=true RELEASE_VERSION=latest KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 DB_DIR=db-data-2 docker-compose up -d db clickhouse redis es keycloak registry certificate-signer certificate-api kafka zookeeper notification-ms metrics + @docker-compose --env-file test_environments/test2.env up -d db clickhouse redis es keycloak registry certificate-signer certificate-api kafka zookeeper notification-ms metrics @echo "Starting the test" && sh build/wait_for_port.sh 8080 @echo "Starting the test" && sh build/wait_for_port.sh 8081 @docker-compose ps diff --git a/docker-compose.yml b/docker-compose.yml index 42d713bc1..de6b59a56 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,13 +55,13 @@ services: - sunbird_sso_admin_client_id=${KEYCLOAK_ADMIN_CLIENT_ID-admin-api} - sunbird_sso_client_id=${KEYCLOAK_CLIENT_ID-registry-frontend} - sunbird_sso_admin_client_secret=${KEYCLOAK_SECRET} - - claims_enabled=false + - claims_enabled=${CLAIMS_ENABLED-false} - claims_url=http://claim-ms:8082 - - signature_enabled=false + - signature_enabled=${SIGNATURE_ENABLED-false} - sign_url=http://certificate-signer:8079/sign - verify_url=http://certificate-signer:8079/verify - sign_health_check_url=http://certificate-signer:8079/health - - certificate_enabled=false + - certificate_enabled=${CERTIFICATE_ENABLED-false} - pdf_url=http://certificate-api:8078/api/v1/certificatePDF - certificate_health_check_url=http://certificate-api:8078/health - template_base_url=http://registry:8081/api/v1/templates/ #Looks for certificate templates for pdf copy of the signed certificate diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/helper/EntityStateHelper.java b/java/registry/src/main/java/dev/sunbirdrc/registry/helper/EntityStateHelper.java index c3d171d28..c89871739 100644 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/helper/EntityStateHelper.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/helper/EntityStateHelper.java @@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.lang.Nullable; import org.springframework.stereotype.Component; import javax.validation.constraints.NotEmpty; @@ -48,7 +49,7 @@ public class EntityStateHelper { @Autowired public EntityStateHelper(IDefinitionsManager definitionsManager, RuleEngineService ruleEngineService, - ConditionResolverService conditionResolverService, ClaimRequestClient claimRequestClient) { + ConditionResolverService conditionResolverService,@Nullable ClaimRequestClient claimRequestClient) { this.definitionsManager = definitionsManager; this.ruleEngineService = ruleEngineService; this.conditionResolverService = conditionResolverService; diff --git a/test_environments/test1.env b/test_environments/test1.env new file mode 100644 index 000000000..d3d4c9204 --- /dev/null +++ b/test_environments/test1.env @@ -0,0 +1,11 @@ +# test with distributed definition manager and native search +VIEW_DIR=java/apitest/src/test/resources/views +SCHEMA_DIR=java/apitest/src/test/resources/schemas +SIGNATURE_ENABLED=true +CERTIFICATE_ENABLED=true +RELEASE_VERSION=latest +SEARCH_PROVIDER_NAME=dev.sunbirdrc.registry.service.NativeSearchService +KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources +KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 +MANAGER_TYPE=DistributedDefinitionsManager +DB_DIR=db-data-1 diff --git a/test_environments/test2.env b/test_environments/test2.env new file mode 100644 index 000000000..18e661aec --- /dev/null +++ b/test_environments/test2.env @@ -0,0 +1,14 @@ +# test with kafka(async), events, notifications +VIEW_DIR=java/apitest/src/test/resources/views +SCHEMA_DIR=java/apitest/src/test/resources/schemas +SIGNATURE_ENABLED=true +CERTIFICATE_ENABLED=true +NOTIFICATION_ENABLED=true +TRACK_NOTIFICATIONS=true +EVENT_ENABLED=true +ASYNC_ENABLED=true +RELEASE_VERSION=latest +NOTIFICATION_URL=http://notification-ms:8765/notification-service/v1/notification +KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources +KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 +DB_DIR=db-data-2