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

adding integ tests for S3Control to get better coverage for inconsist… #2261

Merged
merged 2 commits into from
Jan 29, 2021

Conversation

cenedhryn
Copy link
Contributor

…ent exception unmarshalling

Description

Adds integration tests for s3control

Motivation and Context

There is an ongoing issue which is now partially fixed:
#1986

These tests show that the error code is now correctly returned, but it does not return an InvalidRequestException, it's parsed as an S3ControlException, so the fix is not complete.

Testing

Local integ tests

@@ -20,6 +20,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.assertj.core.api.ThrowableAssert;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this dependency wasn't used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that, built with the quick flag...

@@ -29,6 +30,7 @@
import software.amazon.awssdk.http.SdkHttpFullRequest;
import software.amazon.awssdk.services.s3control.model.DeletePublicAccessBlockRequest;
import software.amazon.awssdk.services.s3control.model.GetPublicAccessBlockResponse;
import software.amazon.awssdk.services.s3control.model.InvalidRequestException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this dependency also wasn't used?

client.getPublicAccessBlock(r -> r.accountId(accountId));
fail("Expected exception");
} catch (S3ControlException e) {
assertEquals("NoSuchPublicAccessBlockConfiguration", e.awsErrorDetails().errorCode());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to assertThat? And same as all the other usages below? assertThat is more readable and flexible, and it's used more often in our code base.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer assertThat too. Changed all assertEquals in the file (but did not touch the assertTrue etc)

@codecov-io
Copy link

codecov-io commented Jan 26, 2021

Codecov Report

Merging #2261 (3cbc82e) into master (88e0c71) will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2261      +/-   ##
============================================
+ Coverage     77.63%   77.64%   +0.01%     
- Complexity      335      367      +32     
============================================
  Files          1231     1237       +6     
  Lines         38742    38904     +162     
  Branches       3052     3064      +12     
============================================
+ Hits          30078    30208     +130     
- Misses         7202     7234      +32     
  Partials       1462     1462              
Flag Coverage Δ Complexity Δ
unittests 77.64% <ø> (+0.01%) 0.00 <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...ine/stages/ApiCallAttemptTimeoutTrackingStage.java 93.10% <0.00%> (-6.90%) 0.00% <0.00%> (ø%)
...on/awssdk/codegen/lite/regions/model/Endpoint.java 16.43% <0.00%> (-2.41%) 0.00% <0.00%> (ø%)
.../converter/attribute/StringAttributeConverter.java 96.42% <0.00%> (ø) 0.00% <0.00%> (ø%)
...ne/internal/CreateDbClusterPresignInterceptor.java 100.00% <0.00%> (ø) 3.00% <0.00%> (?%)
...rvices/neptune/internal/RdsPresignInterceptor.java 92.45% <0.00%> (ø) 9.00% <0.00%> (?%)
...db/internal/CreateDbClusterPresignInterceptor.java 100.00% <0.00%> (ø) 3.00% <0.00%> (?%)
...services/docdb/internal/RdsPresignInterceptor.java 92.45% <0.00%> (ø) 9.00% <0.00%> (?%)
...ernal/CopyDbClusterSnapshotPresignInterceptor.java 100.00% <0.00%> (ø) 4.00% <0.00%> (?%)
...ernal/CopyDbClusterSnapshotPresignInterceptor.java 100.00% <0.00%> (ø) 4.00% <0.00%> (?%)
...ware/amazon/awssdk/utils/cache/CachedSupplier.java 90.24% <0.00%> (+2.43%) 0.00% <0.00%> (ø%)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 88e0c71...3cbc82e. Read the comment docs.

@cenedhryn cenedhryn force-pushed the salande/s3control-check-error-types branch from b3675cd to 3cbc82e Compare January 27, 2021 16:13
@sonarcloud
Copy link

sonarcloud bot commented Jan 29, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@cenedhryn cenedhryn merged commit b3f40d9 into master Jan 29, 2021
@cenedhryn cenedhryn deleted the salande/s3control-check-error-types branch March 7, 2022 18:51
aws-sdk-java-automation added a commit that referenced this pull request Nov 21, 2022
…4ed531483

Pull request: release <- staging/235e6696-1ffa-4ba0-a994-5aa4ed531483
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants