This repository has been archived by the owner on Feb 7, 2025. It is now read-only.
generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 10
Add Golden Copy Tests #1674
Open
pluckyswan
wants to merge
109
commits into
main
Choose a base branch
from
golden-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add Golden Copy Tests #1674
Changes from all commits
Commits
Show all changes
109 commits
Select commit
Hold shift + click to select a range
07b96d1
WIP Initial setup
jherrflexion 2d14e9a
add notes for later and initial setup/cleanup
pluckyswan f8afd54
Added basic compare
jherrflexion dad2cd3
Testing workflow dispatch
jherrflexion 1d8877c
Aded Golden tests to gradle
jherrflexion 9b81688
Adding Golden tests to Workflows
jherrflexion d4867f7
Added fetch parameter
jherrflexion 87dbc14
Removed comments
jherrflexion 5bef9f0
add input files and delete unused input files
pluckyswan 83edb87
refactor file fetcher and implementation
pluckyswan 084387d
refactor file fetcher calls
pluckyswan 1e49731
add env to workflow and rename file path
pluckyswan 3de1187
modify example files to be aligned with readme reqs
pluckyswan ebe7a46
move directory up one and fix file paths
pluckyswan 9605cc1
move golden copy to automated to get files after transformed
pluckyswan f63c56c
use correct syntax
pluckyswan de61fb5
make variables strings
pluckyswan 96cae6c
add dollar sign to echo
pluckyswan e17f1e9
try fixing format
pluckyswan 0747ee8
change syntax
pluckyswan bdbed53
remove line break at end of line in example files
pluckyswan 71a243d
add double quotes to if statement
pluckyswan 24e5ac3
add golden copy versions of example files and revert to og directory …
pluckyswan 401c50f
modify msh-10 header in example file
pluckyswan 229af63
fix syntax
pluckyswan 9485cda
remove breaks from example file
pluckyswan 3c850de
add example file
pluckyswan 1f0dde2
remove comment, add quotes to variable, and create workflow file
pluckyswan d7623ae
remove done
pluckyswan 92c039c
remove unused workflow
pluckyswan f29edc1
add id to workflow step
pluckyswan 5b648b7
separate workflows and update readme
pluckyswan 7b545da
add notes on next steps
pluckyswan ccca6ab
stub out filter for organizing and fetching azure files
pluckyswan 6873446
modify filter for file paths
pluckyswan 9fbe6fa
update readme and file examples base on filter for new receiver
pluckyswan 885cd21
fix uses pathing
pluckyswan bc83820
fix uses pathing
pluckyswan cf0489f
add workflow dispatch
pluckyswan 91371ae
combine submit workflows into one and update readmes
pluckyswan 000d590
delete unused workflow
pluckyswan 06558f7
rename reusable workflow
pluckyswan 0fba3fb
readd the og workflow and delete new one
pluckyswan a9cf564
move folders around
pluckyswan 7a13855
fix file changes
pluckyswan 8ca3337
change file path
pluckyswan 5086197
remove semi colon
pluckyswan 85b11b6
mess with pathing regex
pluckyswan 17a5382
correct naming in workflow
pluckyswan 77d9c71
use correct inputs syntax
pluckyswan b67cd88
workflow fixes
pluckyswan 7143562
pass secrets to workflow
pluckyswan c87d402
fix file path and exclude from test
pluckyswan e6e7fbd
remove incorrect expected files and replace input files
pluckyswan 4977b2f
Merge branch 'main' into golden-tests
jherrflexion f5b1220
Fixed bad character
jherrflexion b0da8ac
Merge branch 'golden-tests' of https://github.com/CDCgov/trusted-inte…
jherrflexion 870cfdb
Updated readme with env variable steps
jherrflexion 4412f6e
Added pull_request to the workflow
jherrflexion 59f0c1a
Temp testing
jherrflexion 8e9b069
Added expected files for testing
jherrflexion 7ba9b0b
Pushing to trigger Action
jherrflexion 1232ae4
Troubleshooting validation error
jherrflexion c4b79e9
Merge branch 'main' into golden-tests
pluckyswan 2943f8f
correct merge conflicts
pluckyswan 2e34325
Removed added white space
basiliskus 5124bdc
rename file path variable to be specifc to rse2e
pluckyswan 88a11fc
rename file path variable in azureblobfetcher
pluckyswan a9c0bc4
remove trigger on pr
pluckyswan ef3d035
add back trigger for pr
pluckyswan 897e2fd
modify file path and make error more specific
pluckyswan 0847dc8
rename expected files to include expected in file name and add logging
pluckyswan ef12692
fix expected file and remove debug logs
pluckyswan c95c0ad
cleanup todos
pluckyswan 72dc7d6
combine groovy tests into one file and change workflows to match
pluckyswan cf22c63
Merge branch 'main' into golden-tests
pluckyswan 09baadc
update adr
pluckyswan ed42620
update rs-e2e readme
pluckyswan 5bbcb57
remove env variable, pass parameter to fetchFiles, add filePath enum,…
pluckyswan 9a4eb00
remove references of deleted env var
pluckyswan 7ae9e0c
add draft of deleting outdated folders on rerun
pluckyswan e499659
Merge branch 'main' into golden-tests
pluckyswan 19dc37b
uncomment code
pluckyswan 3db4f37
rename assertion related references to be assertion instead of automated
pluckyswan 6b6ba9c
add check to see if all files are received on submit workflow
pluckyswan 6cbe53e
add step to notify slack on failure for submit workflow
pluckyswan 456d294
change { to (
pluckyswan edca887
exit workflow once all files have been attempted to send
pluckyswan ad17fa0
fix if statement syntax
pluckyswan 7040fe1
fix if statement syntax
pluckyswan 10cfe66
fix if statement syntax
pluckyswan c754061
Fixing bash scripts
jcrichlake 5aee5e8
Fixing echo statement
jcrichlake b4fb22d
echo response
pluckyswan 36a56b1
add more echo
pluckyswan b205243
add logging for deletion method
pluckyswan e7b1b64
modify deleteOldBlobs method to iterate through folder instead
pluckyswan 36d5d51
add if statement to differentiate between fresh and old blobs by 7 mins
pluckyswan 9a0480f
revert previous commit
pluckyswan d119945
Merge branch 'main' into golden-tests
pluckyswan 8b3b5b7
add logging
pluckyswan 3723409
modify regex for submiting specific folders
pluckyswan 0a66321
modify isInDateFolder method to include added folders (goldencopy/ass…
pluckyswan ab36748
fix expectedPath in isInDateFolder method to append instead of prepend
pluckyswan 0608498
switch println to logger
pluckyswan 1bef7a8
add if statement to check if prefix returns hl7
pluckyswan 4cbb330
Merge branch 'main' into golden-tests
pluckyswan c224994
fix unit test for isInDateFolder
pluckyswan e113536
fix test
pluckyswan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,23 +6,9 @@ on: | |
workflow_dispatch: | ||
|
||
jobs: | ||
test_files: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run automated tests | ||
env: | ||
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/[email protected] | ||
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 }}" | ||
call-staging-test-run: | ||
uses: ./.github/workflows/staging-test-run_reusable.yml | ||
with: | ||
NAME: 'Automated' | ||
TEST_TYPE: 'test defined assertions on relevant messages' | ||
secrets: inherit # pragma: allowlist secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,8 @@ jobs: | |
|
||
- name: Install jwt-cli | ||
run: | | ||
curl --silent --location https://github.com/mike-engel/jwt-cli/releases/latest/download/jwt-linux.tar.gz | tar xvz -C /usr/local/bin/ | ||
sudo chmod +x /usr/local/bin/jwt | ||
curl --silent --location https://github.com/mike-engel/jwt-cli/releases/latest/download/jwt-linux.tar.gz | tar xvz -C /usr/local/bin/ | ||
sudo chmod +x /usr/local/bin/jwt | ||
|
||
- name: Write private key to file | ||
run: | | ||
|
@@ -28,32 +28,55 @@ jobs: | |
|
||
- name: Send HL7 sample messages to staging RS | ||
run: | | ||
host=https://staging.prime.cdc.gov:443 | ||
client_id=flexion | ||
client_sender=simulated-sender | ||
jwt=$(jwt encode --exp='+5min' --jti $(uuidgen) --alg RS256 \ | ||
-k $client_id.$client_sender -i $client_id.$client_sender \ | ||
-s $client_id.$client_sender -a $host --no-iat -S @/tmp/staging_private_key.pem) | ||
|
||
token=$(curl \ | ||
--header "Content-Type: application/x-www-form-urlencoded" \ | ||
--data "scope=$client_id.*.report" \ | ||
--data "client_assertion=$jwt" \ | ||
--data "client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer" \ | ||
--data "grant_type=client_credentials" \ | ||
--silent \ | ||
"$host/api/token" | jq -r ".access_token") | ||
|
||
for file in $(pwd)/examples/Test/Automated/*.hl7; do | ||
echo "Sending $file" | ||
curl \ | ||
--header "Content-Type: application/hl7-v2" \ | ||
--header "Client: $client_id.$client_sender" \ | ||
--header "Authorization: Bearer $token" \ | ||
--data-binary "@$file" \ | ||
--silent \ | ||
"$host/api/waters" | ||
done | ||
shopt -s globstar | ||
host=https://staging.prime.cdc.gov:443 | ||
client_id=flexion | ||
client_sender=simulated-sender | ||
jwt=$(jwt encode --exp='+5min' --jti $(uuidgen) --alg RS256 \ | ||
-k $client_id.$client_sender -i $client_id.$client_sender \ | ||
-s $client_id.$client_sender -a $host --no-iat -S @/tmp/staging_private_key.pem) | ||
|
||
token=$(curl \ | ||
--header "Content-Type: application/x-www-form-urlencoded" \ | ||
--data "scope=$client_id.*.report" \ | ||
--data "client_assertion=$jwt" \ | ||
--data "client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer" \ | ||
--data "grant_type=client_credentials" \ | ||
--silent \ | ||
"$host/api/token" | jq -r ".access_token") | ||
|
||
failed_to_send="" | ||
for file in $(pwd)/examples/Test/Automated/{Assertion,GoldenCopy/Input}/*.hl7; do | ||
echo "Sending $file" | ||
response=$(curl \ | ||
--header "Content-Type: application/hl7-v2" \ | ||
--header "Client: $client_id.$client_sender" \ | ||
--header "Authorization: Bearer $token" \ | ||
--data-binary "@$file" \ | ||
--silent \ | ||
"$host/api/waters" | jq -r ".overallStatus") | ||
|
||
echo "Response to curl: ${response}" | ||
|
||
if [ "$response" != "Received" ]; then | ||
failed_to_send+="${file}"$'\n' | ||
fi | ||
done | ||
|
||
if [ "$failed_to_send" ]; then | ||
echo "Issue sending files:"$'\n'"${failed_to_send}" | ||
exit 1 | ||
fi | ||
|
||
- name: Send slack notification on test failure | ||
if: failure() | ||
uses: slackapi/[email protected] | ||
with: | ||
webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
webhook-type: incoming-webhook | ||
payload: | | ||
text: "Submit Staging RS Integration Test Failed!: https://github.com/CDCgov/trusted-intermediary/actions/runs/${{ github.run_id }}" | ||
|
||
|
||
- name: Clean up private key | ||
if: always() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Golden Copy Staging Test - Run integration tests | ||
|
||
on: | ||
pull_request: | ||
schedule: | ||
- cron: "10 7 * * 2-6" # Tuesday to Saturday at 2am EST (7:10am UTC) - two hours after `automated-staging-test-submit` runs | ||
workflow_dispatch: | ||
|
||
jobs: | ||
call-staging-test-run: | ||
uses: ./.github/workflows/staging-test-run_reusable.yml | ||
with: | ||
NAME: 'Golden Copy' | ||
TEST_TYPE: 'test golden copy files on actual files' | ||
secrets: inherit # pragma: allowlist secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Staging Test - Run integration tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
TEST_TYPE: | ||
type: string | ||
description: The e2e test to run | ||
required: true | ||
default: 'automatedTest' | ||
NAME: | ||
type: string | ||
description: The name of test | ||
required: true | ||
default: 'Automated' | ||
secrets: | ||
AUTOMATED_TEST_AZURE_STORAGE_CONNECTION_STRING: | ||
required: true | ||
SLACK_WEBHOOK_URL: | ||
required: true | ||
|
||
jobs: | ||
test_files: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run automated tests | ||
env: | ||
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AUTOMATED_TEST_AZURE_STORAGE_CONNECTION_STRING }} | ||
run: | | ||
./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() | ||
uses: slackapi/[email protected] | ||
with: | ||
webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
webhook-type: incoming-webhook | ||
payload: | | ||
text: "${{ inputs.NAME }} Staging RS Integration Test Failed!: https://github.com/CDCgov/trusted-intermediary/actions/runs/${{ github.run_id }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...tomated/GoldenCopy/Expected/001_CA_ORU_R01_CDPH_UCSD_189688314_pre_TI_TC_004_expected.hl7
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...tomated/GoldenCopy/Expected/002_CA_ORU_R01_CDPH_UCSD_189693889_pre_TI_TC002B_expected.hl7
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...utomated/GoldenCopy/Expected/003_CA_ORU_R01_CDPH_UCSD_189671588_pre_TI_TC001_expected.hl7
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...utomated/GoldenCopy/Expected/004_CA_ORU_R01_CDPH_UCSD_189700664_pre_TI_TC000_expected.hl7
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...tomated/GoldenCopy/Expected/005_CA_ORU_R01_CDPH_UCSD_189693889_pre_TI_TC002C_expected.hl7
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...tomated/GoldenCopy/Expected/006_CA_ORU_R01_CDPH_UCSD_189716938_pre_TI_TC002A_expected.hl7
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...oldenCopy/Expected/007_CA_ORU_R01_CDPH_UCSD_189717091_80015955_pre_TI_TC007A_expected.hl7
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...ated/GoldenCopy/Expected/008_CA_ORU_R01_CDPH_UCSD_MRN_80015955_pre_TI_TC007B_expected.hl7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...enCopy/Expected/009_CA_ORU_R01_CDPH_UCSD_MRN_80009320_pre_TI_TC001_Corrected_expected.hl7
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...mated/GoldenCopy/Expected/010_CA_ORU_R01_CDPH_UCSD_MRN_80015980_pre_TI_TC006_expected.hl7
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the PR is approved, I will remove
pull_request
. It is only included because a workflow has to be merged into main to be called/updated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This got buried in the commits but is important to note!