From 1a29afed8bc1a62b40f609286dd90ae8b21dbf35 Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Tue, 26 Nov 2024 08:23:38 -0800 Subject: [PATCH 1/9] Changing assertion to make test fail, for testing purposes --- rs-e2e/src/main/resources/assertion_definitions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs-e2e/src/main/resources/assertion_definitions.json b/rs-e2e/src/main/resources/assertion_definitions.json index d8020c466..658a35d47 100644 --- a/rs-e2e/src/main/resources/assertion_definitions.json +++ b/rs-e2e/src/main/resources/assertion_definitions.json @@ -25,7 +25,7 @@ "PID-3.5 = ''", "PID-5.7 = ''", "OBR-4.1 = '54089-8'", - "OBR-4.3 = 'CDPHGSPEAP'", + "OBR-4.3 = 'INCORRECT'", "ORC-2.1 = input.ORC-4.1", "ORC-2.2 = input.ORC-4.2", "ORC-4.1 = input.ORC-2.1", From 0adc69ffee7513b2bd6078c0674f4ba290454342 Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Tue, 26 Nov 2024 09:09:38 -0800 Subject: [PATCH 2/9] Trying out a couple of changes to improve logging in the CI/CD --- .../workflows/automated-staging-test-run.yml | 19 ++++++++++--------- rs-e2e/build.gradle | 9 +++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/automated-staging-test-run.yml b/.github/workflows/automated-staging-test-run.yml index ccfafc56e..a43b778b2 100644 --- a/.github/workflows/automated-staging-test-run.yml +++ b/.github/workflows/automated-staging-test-run.yml @@ -16,13 +16,14 @@ jobs: - name: Run automated tests env: AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AUTOMATED_TEST_AZURE_STORAGE_CONNECTION_STRING }} - run: ./gradlew rs-e2e:clean rs-e2e:automatedTest + ORG_GRADLE_CONSOLE: plain + run: ./gradlew rs-e2e:clean rs-e2e:automatedTest --info --stacktrace - - name: Send slack notification on test failure - if: failure() - uses: slackapi/slack-github-action@v2.0.0 - with: - webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - webhook-type: incoming-webhook - payload: | - text: "Automated Staging RS Integration Test Failed!: https://github.com/CDCgov/trusted-intermediary/actions/runs/${{ github.run_id }}" + # - name: Send slack notification on test failure + # if: failure() + # uses: slackapi/slack-github-action@v2.0.0 + # with: + # webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + # webhook-type: incoming-webhook + # payload: | + # text: "Automated Staging RS Integration Test Failed!: https://github.com/CDCgov/trusted-intermediary/actions/runs/${{ github.run_id }}" diff --git a/rs-e2e/build.gradle b/rs-e2e/build.gradle index 8dcf2bf0b..268478742 100644 --- a/rs-e2e/build.gradle +++ b/rs-e2e/build.gradle @@ -36,4 +36,13 @@ tasks.named('test') { task automatedTest(type: Test) { useJUnitPlatform() include '**/AutomatedTest.*' + + testLogging { + events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' + exceptionFormat 'full' + showExceptions true + showCauses true + showStackTraces true + showStandardStreams true + } } From d0256fe0d59edf3b15fd8a4072c52b3d7e1929b3 Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Tue, 26 Nov 2024 09:16:42 -0800 Subject: [PATCH 3/9] Trying out different options --- .github/workflows/automated-staging-test-run.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automated-staging-test-run.yml b/.github/workflows/automated-staging-test-run.yml index a43b778b2..52c24caf7 100644 --- a/.github/workflows/automated-staging-test-run.yml +++ b/.github/workflows/automated-staging-test-run.yml @@ -17,7 +17,7 @@ jobs: env: AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AUTOMATED_TEST_AZURE_STORAGE_CONNECTION_STRING }} ORG_GRADLE_CONSOLE: plain - run: ./gradlew rs-e2e:clean rs-e2e:automatedTest --info --stacktrace + run: ./gradlew rs-e2e:clean rs-e2e:automatedTest # - name: Send slack notification on test failure # if: failure() From 68c1ef17845e95c3acc521f9e6effc51c12a813a Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Tue, 26 Nov 2024 09:20:12 -0800 Subject: [PATCH 4/9] Trying out different options --- .github/workflows/automated-staging-test-run.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/automated-staging-test-run.yml b/.github/workflows/automated-staging-test-run.yml index 52c24caf7..48fcd5be6 100644 --- a/.github/workflows/automated-staging-test-run.yml +++ b/.github/workflows/automated-staging-test-run.yml @@ -16,7 +16,6 @@ jobs: - name: Run automated tests env: AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AUTOMATED_TEST_AZURE_STORAGE_CONNECTION_STRING }} - ORG_GRADLE_CONSOLE: plain run: ./gradlew rs-e2e:clean rs-e2e:automatedTest # - name: Send slack notification on test failure From f238d860493ab2c58783a6800e038ce0b47900de Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Tue, 26 Nov 2024 09:36:48 -0800 Subject: [PATCH 5/9] Trying out different options --- rs-e2e/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rs-e2e/build.gradle b/rs-e2e/build.gradle index 268478742..6bf5da82b 100644 --- a/rs-e2e/build.gradle +++ b/rs-e2e/build.gradle @@ -38,11 +38,11 @@ task automatedTest(type: Test) { include '**/AutomatedTest.*' testLogging { - events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' + // events 'failed' exceptionFormat 'full' - showExceptions true - showCauses true + // showExceptions true + // showCauses true showStackTraces true - showStandardStreams true + // showStandardStreams true } } From dd55f81c43db3420d87c11b5529b12e886b84d48 Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:36:12 -0800 Subject: [PATCH 6/9] Trying out different options --- .../cdc/trustedintermediary/rse2e/AutomatedTest.groovy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy index 73c62db06..5e27de6df 100644 --- a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy +++ b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy @@ -19,6 +19,7 @@ class AutomatedTest extends Specification { AssertionRuleEngine engine HapiHL7FileMatcher fileMatcher Logger mockLogger = Mock(Logger) + List loggedWarnings = [] def setup() { engine = AssertionRuleEngine.getInstance() @@ -35,6 +36,10 @@ class AutomatedTest extends Specification { TestApplicationContext.register(LocalFileFetcher, LocalFileFetcher.getInstance()) TestApplicationContext.injectRegisteredImplementations() + mockLogger.logWarning(_ as String, _ as Object) >> { String msg, Object args -> + loggedWarnings << msg + } + FileFetcher azureFileFetcher = AzureBlobFileFetcher.getInstance() azureFiles = azureFileFetcher.fetchFiles() @@ -66,6 +71,8 @@ class AutomatedTest extends Specification { then: rulesToEvaluate.collect { it.name }.isEmpty() //Check whether all the rules in the assertions file have been run 0 * mockLogger.logError(_ as String, _ as Exception) - 0 * mockLogger.logWarning(_ as String) + if (!loggedWarnings.isEmpty()) { + throw new AssertionError("Unexpected warnings were logged:\n- ${loggedWarnings.join('\n- ')}") + } } } From 8805104e05afae78d082204994b2968fb5511dd9 Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:46:00 -0800 Subject: [PATCH 7/9] Trying out different options --- .github/workflows/automated-staging-test-run.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/automated-staging-test-run.yml b/.github/workflows/automated-staging-test-run.yml index 48fcd5be6..abafa15f6 100644 --- a/.github/workflows/automated-staging-test-run.yml +++ b/.github/workflows/automated-staging-test-run.yml @@ -16,7 +16,8 @@ jobs: - name: Run automated tests env: AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AUTOMATED_TEST_AZURE_STORAGE_CONNECTION_STRING }} - run: ./gradlew rs-e2e:clean rs-e2e:automatedTest + ORG_GRADLE_CONSOLE: plain + run: ./gradlew rs-e2e:clean rs-e2e:automatedTest --quiet # - name: Send slack notification on test failure # if: failure() From f4df4974b0583675c0bda16d27d716cb364a3189 Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Tue, 26 Nov 2024 13:28:03 -0800 Subject: [PATCH 8/9] Cleanup --- .github/workflows/automated-staging-test-run.yml | 3 +-- rs-e2e/build.gradle | 6 +----- .../trustedintermediary/rse2e/AutomatedTest.groovy | 12 +++++++----- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/automated-staging-test-run.yml b/.github/workflows/automated-staging-test-run.yml index abafa15f6..48fcd5be6 100644 --- a/.github/workflows/automated-staging-test-run.yml +++ b/.github/workflows/automated-staging-test-run.yml @@ -16,8 +16,7 @@ jobs: - name: Run automated tests env: AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AUTOMATED_TEST_AZURE_STORAGE_CONNECTION_STRING }} - ORG_GRADLE_CONSOLE: plain - run: ./gradlew rs-e2e:clean rs-e2e:automatedTest --quiet + run: ./gradlew rs-e2e:clean rs-e2e:automatedTest # - name: Send slack notification on test failure # if: failure() diff --git a/rs-e2e/build.gradle b/rs-e2e/build.gradle index 6bf5da82b..ce4810e02 100644 --- a/rs-e2e/build.gradle +++ b/rs-e2e/build.gradle @@ -38,11 +38,7 @@ task automatedTest(type: Test) { include '**/AutomatedTest.*' testLogging { - // events 'failed' - exceptionFormat 'full' - // showExceptions true - // showCauses true showStackTraces true - // showStandardStreams true + exceptionFormat 'full' } } diff --git a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy index 5e27de6df..ea7257832 100644 --- a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy +++ b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/AutomatedTest.groovy @@ -19,7 +19,7 @@ class AutomatedTest extends Specification { AssertionRuleEngine engine HapiHL7FileMatcher fileMatcher Logger mockLogger = Mock(Logger) - List loggedWarnings = [] + List loggedErrorsAndWarnings = [] def setup() { engine = AssertionRuleEngine.getInstance() @@ -37,7 +37,10 @@ class AutomatedTest extends Specification { TestApplicationContext.injectRegisteredImplementations() mockLogger.logWarning(_ as String, _ as Object) >> { String msg, Object args -> - loggedWarnings << msg + loggedErrorsAndWarnings << msg + } + mockLogger.logError(_ as String, _ as Exception) >> { String msg, Exception e -> + loggedErrorsAndWarnings << msg } FileFetcher azureFileFetcher = AzureBlobFileFetcher.getInstance() @@ -70,9 +73,8 @@ class AutomatedTest extends Specification { then: rulesToEvaluate.collect { it.name }.isEmpty() //Check whether all the rules in the assertions file have been run - 0 * mockLogger.logError(_ as String, _ as Exception) - if (!loggedWarnings.isEmpty()) { - throw new AssertionError("Unexpected warnings were logged:\n- ${loggedWarnings.join('\n- ')}") + if (!loggedErrorsAndWarnings.isEmpty()) { + throw new AssertionError("Unexpected errors and/or warnings were logged:\n- ${loggedErrorsAndWarnings.join('\n- ')}") } } } From f21f84ecedbc6b9d376fe740bfb53f8727c68cbc Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:31:29 -0800 Subject: [PATCH 9/9] Reverted changes for testing --- .github/workflows/automated-staging-test-run.yml | 16 ++++++++-------- .../main/resources/assertion_definitions.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/automated-staging-test-run.yml b/.github/workflows/automated-staging-test-run.yml index 48fcd5be6..ccfafc56e 100644 --- a/.github/workflows/automated-staging-test-run.yml +++ b/.github/workflows/automated-staging-test-run.yml @@ -18,11 +18,11 @@ jobs: AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AUTOMATED_TEST_AZURE_STORAGE_CONNECTION_STRING }} run: ./gradlew rs-e2e:clean rs-e2e:automatedTest - # - name: Send slack notification on test failure - # if: failure() - # uses: slackapi/slack-github-action@v2.0.0 - # with: - # webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - # webhook-type: incoming-webhook - # payload: | - # text: "Automated Staging RS Integration Test Failed!: https://github.com/CDCgov/trusted-intermediary/actions/runs/${{ github.run_id }}" + - name: Send slack notification on test failure + if: failure() + uses: slackapi/slack-github-action@v2.0.0 + with: + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + webhook-type: incoming-webhook + payload: | + text: "Automated Staging RS Integration Test Failed!: https://github.com/CDCgov/trusted-intermediary/actions/runs/${{ github.run_id }}" diff --git a/rs-e2e/src/main/resources/assertion_definitions.json b/rs-e2e/src/main/resources/assertion_definitions.json index 658a35d47..d8020c466 100644 --- a/rs-e2e/src/main/resources/assertion_definitions.json +++ b/rs-e2e/src/main/resources/assertion_definitions.json @@ -25,7 +25,7 @@ "PID-3.5 = ''", "PID-5.7 = ''", "OBR-4.1 = '54089-8'", - "OBR-4.3 = 'INCORRECT'", + "OBR-4.3 = 'CDPHGSPEAP'", "ORC-2.1 = input.ORC-4.1", "ORC-2.2 = input.ORC-4.2", "ORC-4.1 = input.ORC-2.1",