Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #119 +/- ##
==========================================
+ Coverage 92.14% 92.72% +0.57%
==========================================
Files 14 14
Lines 2405 2734 +329
Branches 2405 2734 +329
==========================================
+ Hits 2216 2535 +319
- Misses 143 150 +7
- Partials 46 49 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Simon Marty <martysi@amazon.com>
de875e6 to
cde666a
Compare
| .unwrap(); | ||
| match client.get_secret_value(secret_id, None, None, false).await { | ||
| Ok(_) => panic!(), | ||
| Err(e) => e.to_string().contains("Access to KMS is not allowed"), |
There was a problem hiding this comment.
This evaluates to a bool that's silently discarded. The test passes even if the error message is completely wrong. I think we need to add assert!():
Err(e) => assert!(e.to_string().contains("Access to KMS is not allowed")),
|
|
||
| let describe_secret = | ||
| mock!(aws_sdk_secretsmanager::Client::describe_secret).then_error(|| { | ||
| // TODO: Figure out how to set __type |
There was a problem hiding this comment.
Should this be resolved before merging? The old mock returned raw HTTP with "__type":"AccessDeniedException" which the SDK deserializes into the proper error variant. The new mock uses DescribeSecretError::generic(...) which is an unmodeled error. If the code under test distinguishes AccessDeniedException from other errors, this test is weaker than before. If it doesn't, we should remove the TODO.
There was a problem hiding this comment.
Whoops, completely missed that. Will find a way to address the TODO in the next rev.
| #[tokio::test] | ||
| async fn test_is_current_default_succeeds() { | ||
| let client = fake_client(Some(Duration::from_secs(0)), false, None, None); | ||
| async fn test_get_cache_is_current_fast_refreshes() { |
There was a problem hiding this comment.
The is_current tests (test_get_cache_is_current_fast_refreshes, test_is_current_version_id_succeeds, test_is_current_version_stage_succeeds, test_is_current_both_version_id_and_version_stage_succeed) share ~90% identical setup: same GSV mock, same describe mock, same client construction, same assertion loop. A helper that takes optional version_id/version_stage and returns a configured client + mock rules would cut a lot of duplication. The old code had fake_client() for this, looks like we removed it for mock-based tests but didn't replace it.
Signed-off-by: Simon Marty <martysi@amazon.com>
Issue #, if available:
Description of changes: Accidentally closed #112 on a force push.
Move unit tests to aws-smithy-mocks for easier test coverage.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.