From b6d79196dee5c74daf277cba396addeedfc46c7e Mon Sep 17 00:00:00 2001 From: Joe Edwards Date: Fri, 10 Jan 2025 10:25:23 +0000 Subject: [PATCH] BAU: Use local mode for AWS EMF when running tests --- build.gradle | 7 +++++++ lambdas/build-client-oauth-response/build.gradle | 2 -- lambdas/build-cri-oauth-request/build.gradle | 2 -- lambdas/build-proven-user-identity-details/build.gradle | 2 -- lambdas/build-user-identity/build.gradle | 2 -- lambdas/call-dcmaw-async-cri/build.gradle | 2 -- lambdas/call-ticf-cri/build.gradle | 2 -- lambdas/check-coi/build.gradle | 2 -- lambdas/check-existing-identity/build.gradle | 2 -- lambdas/check-gpg45-score/build.gradle | 2 -- lambdas/check-mobile-app-vc-receipt/build.gradle | 2 -- lambdas/check-reverification-identity/build.gradle | 2 -- lambdas/evaluate-gpg45-scores/build.gradle | 2 -- lambdas/initialise-ipv-session/build.gradle | 2 -- lambdas/issue-client-access-token/build.gradle | 2 -- lambdas/process-async-cri-credential/build.gradle | 2 -- lambdas/process-candidate-identity/build.gradle | 2 -- lambdas/process-cri-callback/build.gradle | 2 -- lambdas/process-journey-event/build.gradle | 2 -- lambdas/process-mobile-app-callback/build.gradle | 2 -- lambdas/reset-session-identity/build.gradle | 2 -- lambdas/store-identity/build.gradle | 2 -- lambdas/user-reverification/build.gradle | 2 -- libs/cri-api-service/build.gradle | 2 -- libs/evcs-service/build.gradle | 2 -- libs/oauth-key-service/build.gradle | 2 -- libs/ticf-cri-service/build.gradle | 2 -- libs/verifiable-credentials/build.gradle | 2 -- 28 files changed, 7 insertions(+), 54 deletions(-) diff --git a/build.gradle b/build.gradle index 73ad5871b3..4fe58c27dd 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,13 @@ subprojects { configurations.all { exclude group: 'software.amazon.awssdk', module: 'apache-client' } + + tasks.withType(Test) { + // Configures environment variables to avoid errors in AWS X-Ray and EMF loggers + environment "LAMBDA_TASK_ROOT", "handler" + environment 'AWS_EMF_ENVIRONMENT', 'Local' + environment 'AWS_XRAY_CONTEXT_MISSING', 'IGNORE_ERROR' + } } allprojects { diff --git a/lambdas/build-client-oauth-response/build.gradle b/lambdas/build-client-oauth-response/build.gradle index b462de9998..c8a2df9033 100644 --- a/lambdas/build-client-oauth-response/build.gradle +++ b/lambdas/build-client-oauth-response/build.gradle @@ -25,8 +25,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/build-cri-oauth-request/build.gradle b/lambdas/build-cri-oauth-request/build.gradle index 1311588617..eb68644a7a 100644 --- a/lambdas/build-cri-oauth-request/build.gradle +++ b/lambdas/build-cri-oauth-request/build.gradle @@ -32,8 +32,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/build-proven-user-identity-details/build.gradle b/lambdas/build-proven-user-identity-details/build.gradle index 7393fd674b..d2d1de49e9 100644 --- a/lambdas/build-proven-user-identity-details/build.gradle +++ b/lambdas/build-proven-user-identity-details/build.gradle @@ -29,8 +29,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/build-user-identity/build.gradle b/lambdas/build-user-identity/build.gradle index 812e88f0d0..46984c942f 100644 --- a/lambdas/build-user-identity/build.gradle +++ b/lambdas/build-user-identity/build.gradle @@ -30,8 +30,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport exclude 'uk/gov/di/ipv/core/builduseridentity/pact/**' diff --git a/lambdas/call-dcmaw-async-cri/build.gradle b/lambdas/call-dcmaw-async-cri/build.gradle index a3c0ec0f35..b988d3cf56 100644 --- a/lambdas/call-dcmaw-async-cri/build.gradle +++ b/lambdas/call-dcmaw-async-cri/build.gradle @@ -31,8 +31,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport exclude 'uk/gov/di/ipv/core/calldcmawasynccri/pact/**' diff --git a/lambdas/call-ticf-cri/build.gradle b/lambdas/call-ticf-cri/build.gradle index 90b3661905..9c3abd5b3b 100644 --- a/lambdas/call-ticf-cri/build.gradle +++ b/lambdas/call-ticf-cri/build.gradle @@ -30,8 +30,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport exclude 'uk/gov/di/ipv/core/callticfcri/pact/**' diff --git a/lambdas/check-coi/build.gradle b/lambdas/check-coi/build.gradle index 75ef16fcad..210b0b0216 100644 --- a/lambdas/check-coi/build.gradle +++ b/lambdas/check-coi/build.gradle @@ -28,8 +28,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform() finalizedBy jacocoTestReport } diff --git a/lambdas/check-existing-identity/build.gradle b/lambdas/check-existing-identity/build.gradle index aff4ab7e73..0d069e5b2c 100644 --- a/lambdas/check-existing-identity/build.gradle +++ b/lambdas/check-existing-identity/build.gradle @@ -36,8 +36,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/check-gpg45-score/build.gradle b/lambdas/check-gpg45-score/build.gradle index 5f9728a4d5..4ed61eeb22 100644 --- a/lambdas/check-gpg45-score/build.gradle +++ b/lambdas/check-gpg45-score/build.gradle @@ -29,8 +29,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/check-mobile-app-vc-receipt/build.gradle b/lambdas/check-mobile-app-vc-receipt/build.gradle index e704eae608..bf0c95788a 100644 --- a/lambdas/check-mobile-app-vc-receipt/build.gradle +++ b/lambdas/check-mobile-app-vc-receipt/build.gradle @@ -35,8 +35,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport exclude 'uk/gov/di/ipv/core/checkmobileappvcreceipt/pact/**' diff --git a/lambdas/check-reverification-identity/build.gradle b/lambdas/check-reverification-identity/build.gradle index 02e33c46f1..2da9d5c100 100644 --- a/lambdas/check-reverification-identity/build.gradle +++ b/lambdas/check-reverification-identity/build.gradle @@ -28,8 +28,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/evaluate-gpg45-scores/build.gradle b/lambdas/evaluate-gpg45-scores/build.gradle index 7cdf61a7de..28c7346180 100644 --- a/lambdas/evaluate-gpg45-scores/build.gradle +++ b/lambdas/evaluate-gpg45-scores/build.gradle @@ -30,8 +30,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/initialise-ipv-session/build.gradle b/lambdas/initialise-ipv-session/build.gradle index 94f60150a5..cc254b366c 100644 --- a/lambdas/initialise-ipv-session/build.gradle +++ b/lambdas/initialise-ipv-session/build.gradle @@ -35,8 +35,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/issue-client-access-token/build.gradle b/lambdas/issue-client-access-token/build.gradle index ea10df4d07..6f3d2618a5 100644 --- a/lambdas/issue-client-access-token/build.gradle +++ b/lambdas/issue-client-access-token/build.gradle @@ -32,8 +32,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport exclude 'uk/gov/di/ipv/core/issueclientaccesstoken/pact/**' diff --git a/lambdas/process-async-cri-credential/build.gradle b/lambdas/process-async-cri-credential/build.gradle index 4eb6f6bc43..6a2ae86f38 100644 --- a/lambdas/process-async-cri-credential/build.gradle +++ b/lambdas/process-async-cri-credential/build.gradle @@ -33,8 +33,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/process-candidate-identity/build.gradle b/lambdas/process-candidate-identity/build.gradle index 23ae75968e..01c04ae6a0 100644 --- a/lambdas/process-candidate-identity/build.gradle +++ b/lambdas/process-candidate-identity/build.gradle @@ -32,8 +32,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/process-cri-callback/build.gradle b/lambdas/process-cri-callback/build.gradle index 082a31a925..ec6548ae1d 100644 --- a/lambdas/process-cri-callback/build.gradle +++ b/lambdas/process-cri-callback/build.gradle @@ -37,8 +37,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport exclude 'uk/gov/di/ipv/core/processcricallback/pact/**' diff --git a/lambdas/process-journey-event/build.gradle b/lambdas/process-journey-event/build.gradle index 2f819a9ca9..e6faa79dec 100644 --- a/lambdas/process-journey-event/build.gradle +++ b/lambdas/process-journey-event/build.gradle @@ -30,8 +30,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/process-mobile-app-callback/build.gradle b/lambdas/process-mobile-app-callback/build.gradle index f48e9c18b9..7367aaef89 100644 --- a/lambdas/process-mobile-app-callback/build.gradle +++ b/lambdas/process-mobile-app-callback/build.gradle @@ -29,8 +29,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport exclude 'uk/gov/di/ipv/core/processmobileappcallback/pact/**' diff --git a/lambdas/reset-session-identity/build.gradle b/lambdas/reset-session-identity/build.gradle index bcbd9a70dc..5fd67c4f71 100644 --- a/lambdas/reset-session-identity/build.gradle +++ b/lambdas/reset-session-identity/build.gradle @@ -28,8 +28,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/store-identity/build.gradle b/lambdas/store-identity/build.gradle index 0d50c8ebbf..f5304ad4f0 100644 --- a/lambdas/store-identity/build.gradle +++ b/lambdas/store-identity/build.gradle @@ -27,8 +27,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/lambdas/user-reverification/build.gradle b/lambdas/user-reverification/build.gradle index 2f370fae77..02f3c80b59 100644 --- a/lambdas/user-reverification/build.gradle +++ b/lambdas/user-reverification/build.gradle @@ -29,8 +29,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport exclude 'uk/gov/di/ipv/core/userreverification/pact/**' diff --git a/libs/cri-api-service/build.gradle b/libs/cri-api-service/build.gradle index ad39883c1c..d07f7ff4bb 100644 --- a/libs/cri-api-service/build.gradle +++ b/libs/cri-api-service/build.gradle @@ -45,8 +45,6 @@ tasks.named('jar') { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/libs/evcs-service/build.gradle b/libs/evcs-service/build.gradle index a18cb3cffa..937534bd1d 100644 --- a/libs/evcs-service/build.gradle +++ b/libs/evcs-service/build.gradle @@ -49,8 +49,6 @@ tasks.named('jar') { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/libs/oauth-key-service/build.gradle b/libs/oauth-key-service/build.gradle index 40df184a90..dca6ec3df6 100644 --- a/libs/oauth-key-service/build.gradle +++ b/libs/oauth-key-service/build.gradle @@ -44,8 +44,6 @@ tasks.named('jar') { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/libs/ticf-cri-service/build.gradle b/libs/ticf-cri-service/build.gradle index 7bac431979..c6850d8e62 100644 --- a/libs/ticf-cri-service/build.gradle +++ b/libs/ticf-cri-service/build.gradle @@ -32,8 +32,6 @@ java { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport } diff --git a/libs/verifiable-credentials/build.gradle b/libs/verifiable-credentials/build.gradle index 0a212d9a08..f25cb7d2c1 100644 --- a/libs/verifiable-credentials/build.gradle +++ b/libs/verifiable-credentials/build.gradle @@ -49,8 +49,6 @@ tasks.named('jar') { } test { - // Configures environment variable to avoid initialization of AWS X-Ray segments for each tests - environment "LAMBDA_TASK_ROOT", "handler" useJUnitPlatform () finalizedBy jacocoTestReport }