-
Notifications
You must be signed in to change notification settings - Fork 38
Add caching integration tests #138
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
base: main
Are you sure you want to change the base?
Conversation
- test_cache_hit_behavior: Verifies cache hits are faster than AWS calls - test_refresh_now_bypasses_cache: Confirms refreshNow=true bypasses cache - test_cache_after_secret_update: Tests stale cache behavior after secret updates - test_real_ttl_expiration_timing: Validates TTL expiration and cache refresh - test_ttl_zero_disables_caching: Ensures TTL=0 disables caching completely These tests cover all critical caching behaviors that cannot be unit tested, including timing-based assertions and AWS integration scenarios.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #138 +/- ##
=======================================
Coverage 91.72% 91.72%
=======================================
Files 14 14
Lines 2418 2418
Branches 2418 2418
=======================================
Hits 2218 2218
Misses 150 150
Partials 50 50 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Updated caching.rs to only include true integration tests: - test_cache_after_secret_update: Real AWS secret rotation + cache staleness - test_real_ttl_expiration_timing: Real time-based TTL with actual delays - Removed performance-focused tests (moved to future performance suite) - Removed parameter behavior tests (moved to future unit tests) - Fixed GitHub Actions security vulnerability: - Changed pull_request_target to only trigger on 'labeled' events - Eliminates race condition where unapproved code could execute with AWS credentials - Each commit now requires explicit human approval via safe-to-test label - Auto-removes label after use to prevent persistent approval Integration tests now focus on real AWS interactions and timing behavior that cannot be effectively mocked or measured in unit tests.
| - name: Remove safe-to-test label after use | ||
| if: github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe-to-test') | ||
| run: | | ||
| gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/safe-to-test -X DELETE || true |
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 is going to silence all errors that come out of the GitHub API
You can use something like
gh_status=$(gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/safe-to-test" -X DELETE | jq ".status" --raw-output)
case $gh_status in
200) echo "Label removed" ;;
404) echo "Label not found — ignoring" ;;
*) echo "unexpected HTTP $gh_status" && exit 1 ;;
to avoid that
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Remove safe-to-test label after use |
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.
One issue with doing this is that this will prevent re-driving integration workflows that fail due to causes outside of the code. Say there's an AWS outage while a workflow gets run, the label will get removed, then it will have to get re-added so that a new PR workflow can get triggered on the same commit, when in fact that relabeling should not be necessary from a safety standpoint, the commit has already been approved for integ tests by a person.
One way to get around this is to remove the safe-to-test label on the synchronize event like here
*Issue #, if available:* *Description of changes:* Extract the fix in aws@3f073a4 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Signed-off-by: Simon Marty <martysi@amazon.com>
*Issue #, if available:* *Description of changes:* Extract the fix in aws@3f073a4 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Signed-off-by: Simon Marty <martysi@amazon.com>
*Issue #, if available:* *Description of changes:* Extract the fix in aws@3f073a4 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Signed-off-by: Simon Marty <martysi@amazon.com>
Signed-off-by: Simon Marty <simon.marty@protonmail.com>
Signed-off-by: Simon Marty <martysi@amazon.com>
Issue #, if available:
Description of changes:
Added caching integration tests:
test_cache_after_secret_update: Real AWS secret rotation + cache stalenesstest_real_ttl_expiration_timing: Real time-based TTL with actual delaysFixed GitHub Actions security vulnerability:
pull_request_targetto only trigger onlabeledeventssafe-to-testlabelBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.