Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Golden Copy Tests #1674

Draft
wants to merge 98 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
07b96d1
WIP Initial setup
jherrflexion Dec 16, 2024
2d14e9a
add notes for later and initial setup/cleanup
pluckyswan Dec 16, 2024
f8afd54
Added basic compare
jherrflexion Dec 17, 2024
dad2cd3
Testing workflow dispatch
jherrflexion Dec 17, 2024
1d8877c
Aded Golden tests to gradle
jherrflexion Dec 17, 2024
9b81688
Adding Golden tests to Workflows
jherrflexion Dec 17, 2024
d4867f7
Added fetch parameter
jherrflexion Dec 17, 2024
87dbc14
Removed comments
jherrflexion Dec 17, 2024
5bef9f0
add input files and delete unused input files
pluckyswan Dec 18, 2024
83edb87
refactor file fetcher and implementation
pluckyswan Dec 18, 2024
084387d
refactor file fetcher calls
pluckyswan Dec 18, 2024
1e49731
add env to workflow and rename file path
pluckyswan Dec 18, 2024
3de1187
modify example files to be aligned with readme reqs
pluckyswan Dec 19, 2024
ebe7a46
move directory up one and fix file paths
pluckyswan Dec 19, 2024
9605cc1
move golden copy to automated to get files after transformed
pluckyswan Dec 19, 2024
f63c56c
use correct syntax
pluckyswan Dec 19, 2024
de61fb5
make variables strings
pluckyswan Dec 19, 2024
96cae6c
add dollar sign to echo
pluckyswan Dec 19, 2024
e17f1e9
try fixing format
pluckyswan Dec 19, 2024
0747ee8
change syntax
pluckyswan Dec 19, 2024
bdbed53
remove line break at end of line in example files
pluckyswan Dec 19, 2024
71a243d
add double quotes to if statement
pluckyswan Dec 19, 2024
24e5ac3
add golden copy versions of example files and revert to og directory …
pluckyswan Dec 19, 2024
401c50f
modify msh-10 header in example file
pluckyswan Dec 19, 2024
229af63
fix syntax
pluckyswan Dec 19, 2024
9485cda
remove breaks from example file
pluckyswan Dec 19, 2024
3c850de
add example file
pluckyswan Dec 19, 2024
1f0dde2
remove comment, add quotes to variable, and create workflow file
pluckyswan Dec 19, 2024
d7623ae
remove done
pluckyswan Dec 19, 2024
92c039c
remove unused workflow
pluckyswan Dec 19, 2024
f29edc1
add id to workflow step
pluckyswan Dec 19, 2024
5b648b7
separate workflows and update readme
pluckyswan Dec 19, 2024
7b545da
add notes on next steps
pluckyswan Dec 20, 2024
ccca6ab
stub out filter for organizing and fetching azure files
pluckyswan Dec 20, 2024
6873446
modify filter for file paths
pluckyswan Dec 23, 2024
9fbe6fa
update readme and file examples base on filter for new receiver
pluckyswan Dec 23, 2024
885cd21
fix uses pathing
pluckyswan Dec 23, 2024
bc83820
fix uses pathing
pluckyswan Dec 23, 2024
cf0489f
add workflow dispatch
pluckyswan Dec 23, 2024
91371ae
combine submit workflows into one and update readmes
pluckyswan Dec 23, 2024
000d590
delete unused workflow
pluckyswan Dec 23, 2024
06558f7
rename reusable workflow
pluckyswan Dec 23, 2024
0fba3fb
readd the og workflow and delete new one
pluckyswan Dec 23, 2024
a9cf564
move folders around
pluckyswan Dec 23, 2024
7a13855
fix file changes
pluckyswan Dec 23, 2024
8ca3337
change file path
pluckyswan Dec 23, 2024
5086197
remove semi colon
pluckyswan Dec 23, 2024
85b11b6
mess with pathing regex
pluckyswan Dec 23, 2024
17a5382
correct naming in workflow
pluckyswan Dec 24, 2024
77d9c71
use correct inputs syntax
pluckyswan Dec 24, 2024
b67cd88
workflow fixes
pluckyswan Dec 24, 2024
7143562
pass secrets to workflow
pluckyswan Dec 24, 2024
c87d402
fix file path and exclude from test
pluckyswan Dec 24, 2024
e6e7fbd
remove incorrect expected files and replace input files
pluckyswan Dec 24, 2024
4977b2f
Merge branch 'main' into golden-tests
jherrflexion Dec 27, 2024
f5b1220
Fixed bad character
jherrflexion Dec 27, 2024
b0da8ac
Merge branch 'golden-tests' of https://github.com/CDCgov/trusted-inte…
jherrflexion Dec 27, 2024
870cfdb
Updated readme with env variable steps
jherrflexion Dec 27, 2024
4412f6e
Added pull_request to the workflow
jherrflexion Dec 27, 2024
59f0c1a
Temp testing
jherrflexion Dec 27, 2024
8e9b069
Added expected files for testing
jherrflexion Dec 27, 2024
7ba9b0b
Pushing to trigger Action
jherrflexion Dec 31, 2024
1232ae4
Troubleshooting validation error
jherrflexion Dec 31, 2024
c4b79e9
Merge branch 'main' into golden-tests
pluckyswan Jan 3, 2025
2943f8f
correct merge conflicts
pluckyswan Jan 3, 2025
2e34325
Removed added white space
basiliskus Jan 3, 2025
5124bdc
rename file path variable to be specifc to rse2e
pluckyswan Jan 7, 2025
88a11fc
rename file path variable in azureblobfetcher
pluckyswan Jan 7, 2025
a9c0bc4
remove trigger on pr
pluckyswan Jan 7, 2025
ef3d035
add back trigger for pr
pluckyswan Jan 7, 2025
897e2fd
modify file path and make error more specific
pluckyswan Jan 7, 2025
0847dc8
rename expected files to include expected in file name and add logging
pluckyswan Jan 8, 2025
ef12692
fix expected file and remove debug logs
pluckyswan Jan 8, 2025
c95c0ad
cleanup todos
pluckyswan Jan 8, 2025
72dc7d6
combine groovy tests into one file and change workflows to match
pluckyswan Jan 8, 2025
cf22c63
Merge branch 'main' into golden-tests
pluckyswan Jan 8, 2025
09baadc
update adr
pluckyswan Jan 8, 2025
ed42620
update rs-e2e readme
pluckyswan Jan 8, 2025
5bbcb57
remove env variable, pass parameter to fetchFiles, add filePath enum,…
pluckyswan Jan 9, 2025
9a4eb00
remove references of deleted env var
pluckyswan Jan 9, 2025
7ae9e0c
add draft of deleting outdated folders on rerun
pluckyswan Jan 9, 2025
e499659
Merge branch 'main' into golden-tests
pluckyswan Jan 10, 2025
19dc37b
uncomment code
pluckyswan Jan 10, 2025
3db4f37
rename assertion related references to be assertion instead of automated
pluckyswan Jan 10, 2025
6b6ba9c
add check to see if all files are received on submit workflow
pluckyswan Jan 10, 2025
6cbe53e
add step to notify slack on failure for submit workflow
pluckyswan Jan 10, 2025
456d294
change { to (
pluckyswan Jan 10, 2025
edca887
exit workflow once all files have been attempted to send
pluckyswan Jan 10, 2025
ad17fa0
fix if statement syntax
pluckyswan Jan 10, 2025
7040fe1
fix if statement syntax
pluckyswan Jan 10, 2025
10cfe66
fix if statement syntax
pluckyswan Jan 10, 2025
c754061
Fixing bash scripts
jcrichlake Jan 10, 2025
5aee5e8
Fixing echo statement
jcrichlake Jan 10, 2025
b4fb22d
echo response
pluckyswan Jan 10, 2025
36a56b1
add more echo
pluckyswan Jan 10, 2025
b205243
add logging for deletion method
pluckyswan Jan 10, 2025
e7b1b64
modify deleteOldBlobs method to iterate through folder instead
pluckyswan Jan 10, 2025
36d5d51
add if statement to differentiate between fresh and old blobs by 7 mins
pluckyswan Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions .github/workflows/automated-staging-test-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,13 @@ on:
workflow_dispatch:

jobs:
test_files:
send_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]
- name: Call staging-test-run.yml
uses: ./.github/workflows/staging-test-run_reusable.yml
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 }}"
FILE_PATH: '../examples/Test/Automated/'
NAME: 'Automated'
TEST_TYPE: 'automatedTest'
61 changes: 0 additions & 61 deletions .github/workflows/automated-staging-test-submit.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/golden-copy-staging-test-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Golden Copy Staging Test - Run integration tests

on:
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:
send_files:
runs-on: ubuntu-latest

steps:
- name: Call staging-test-run.yml
uses: ./.github/workflows/staging-test-run_reusable.yml
with:
FILE_PATH: '../examples/Test/GoldenCopy/Expected/'
NAME: 'Golden Copy'
TEST_TYPE: 'goldenCopyTest'
42 changes: 42 additions & 0 deletions .github/workflows/staging-test-run_reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Staging Test - Run integration tests

on:
workflow_call:
inputs:
TEST_TYPE:
type: string
description: The e2e test to run
required: true
NAME:
type: string
description: The name of test
required: true
FILE_PATH:
type: string
description: The path to local files
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 }}
LOCAL_FILE_PATH: ${{ github.event.inputs.FILE_PATH }}
run: |
./gradlew rs-e2e:clean rs-e2e:${{ github.event.inputs.TEST_TYPE }}
done

- 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: "${{ github.event.inputs.NAME }} Staging RS Integration Test Failed!: https://github.com/CDCgov/trusted-intermediary/actions/runs/${{ github.run_id }}"
66 changes: 66 additions & 0 deletions .github/workflows/staging-test-submit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Staging Test - Submit Messages

on:
schedule:
- cron: "0 5 * * 2-6" # Tuesday to Saturday at Midnight EST (5am UTC)
workflow_dispatch:

jobs:
send_files:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Install jq
run: sudo apt-get install -y jq

- 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

- name: Write private key to file
run: |
echo "${{ secrets.SIMULATED_SENDER_STAGING_PRIVATE_KEY }}" > /tmp/staging_private_key.pem
chmod 600 /tmp/staging_private_key.pem

- 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")

sendFiles () {
folder_path=$1
for file in "$(pwd)/examples/Test/$folder_path"; 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
}
sendFiles "'Automated/*.hl7'"
sendFiles "'GoldenCopy/Input/*.hl7'"

- name: Clean up private key
if: always()
run: |
rm -f /tmp/staging_private_key.pem
2 changes: 1 addition & 1 deletion examples/Test/Automated/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This folder contains the HL7 sample files that are used in the automated ReportStream
integration tests. The [automated-staging-test-submit.yml](/.github/workflows/automated-staging-test-submit.yml)
integration tests. The [automated-staging-test-submit.yml](/.github/workflows/staging-test-submit.yml)
Github workflow that runs daily will grab these files and send them to ReportStream in staging.
The files are expected to go through the whole flow and to be delivered to an Azure blob
container that will later be used by the
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading