Skip to content

Commit

Permalink
combine groovy tests into one file and change workflows to match
Browse files Browse the repository at this point in the history
Co-authored-by: saquino0827 <[email protected]>
Co-authored-by: basiliskus <[email protected]>
Co-authored-by: halprin <[email protected]>
  • Loading branch information
4 people committed Jan 8, 2025
1 parent c95c0ad commit 72dc7d6
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automated-staging-test-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
with:
RSE2E_LOCAL_INPUT_FILE_PATH: '../examples/Test/Automated/Assertion/'
NAME: 'Automated'
TEST_TYPE: 'automatedTest'
TEST_TYPE: 'test defined assertions on relevant messages'
secrets: inherit # pragma: allowlist secret
2 changes: 1 addition & 1 deletion .github/workflows/golden-copy-staging-test-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ jobs:
with:
RSE2E_LOCAL_INPUT_FILE_PATH: '../examples/Test/Automated/GoldenCopy/Expected/'
NAME: 'Golden Copy'
TEST_TYPE: 'goldenCopyTest'
TEST_TYPE: 'test golden copy files on actual files'
secrets: inherit # pragma: allowlist secret
2 changes: 1 addition & 1 deletion .github/workflows/staging-test-run_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AUTOMATED_TEST_AZURE_STORAGE_CONNECTION_STRING }}
RSE2E_LOCAL_INPUT_FILE_PATH: ${{ inputs.RSE2E_LOCAL_INPUT_FILE_PATH }}
run: |
./gradlew rs-e2e:clean rs-e2e:${{ inputs.TEST_TYPE }}
./gradlew rs-e2e:clean rs-e2e:automatedTest --tests="gov.hhs.cdc.trustedintermediary.rse2e.AutomatedTest.${{inputs.TEST_TYPE}}"
- name: Send slack notification on test failure
if: failure()
Expand Down
11 changes: 0 additions & 11 deletions rs-e2e/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
exclude '**/AutomatedTest.*'
exclude '**/GoldenCopyTest.*'
}

task automatedTest(type: Test) {
Expand All @@ -39,13 +38,3 @@ task automatedTest(type: Test) {
exceptionFormat 'full'
}
}

task goldenCopyTest(type: Test) {
useJUnitPlatform()
include '**/GoldenCopyTest.*'

testLogging {
showStackTraces true
exceptionFormat 'full'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class AutomatedTest extends Specification {
HL7FileMatcher fileMatcher
Logger mockLogger = Mock(Logger)
List<String> loggedErrorsAndWarnings = []
List<String> failedFiles = []


def setup() {
engine = AssertionRuleEngine.getInstance()
Expand Down Expand Up @@ -79,4 +81,24 @@ class AutomatedTest extends Specification {
throw new AssertionError("Unexpected errors and/or warnings were logged:\n- ${loggedErrorsAndWarnings.join('\n- ')}")
}
}

def "test golden copy files on actual files"() {
given:
def matchedFiles = fileMatcher.matchFiles(azureFiles, localFiles)

when:
for (filePair in matchedFiles) {
def actualFile = filePair.getKey()
def expectedFile = filePair.getValue()
if (actualFile.toString() != expectedFile.toString()) {
failedFiles.add(expectedFile.getIdentifier())
}
}

then:
assert failedFiles.isEmpty()
if (!loggedErrorsAndWarnings.isEmpty()) {
throw new AssertionError("Unexpected errors and/or warnings were logged:\n- ${loggedErrorsAndWarnings.join('\n- ')}")
}
}
}

This file was deleted.

0 comments on commit 72dc7d6

Please sign in to comment.