Skip to content

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

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

Merged
merged 2 commits into from
Jan 29, 2021
Merged
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Fail.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -86,7 +85,7 @@ public void putPublicAccessBlock_NoSuchAccount() {
.publicAccessBlockConfiguration(r2 -> r2.restrictPublicBuckets(true))));
fail("Expected exception");
} catch (S3ControlException e) {
assertEquals("AccessDenied", e.awsErrorDetails().errorCode());
assertThat(e.awsErrorDetails().errorCode()).isEqualTo("AccessDenied");
assertNotNull(e.requestId());
}
}
Expand All @@ -97,7 +96,41 @@ public void getPublicAccessBlock_NoSuchAccount() {
client.getPublicAccessBlock(r -> r.accountId(INVALID_ACCOUNT_ID));
fail("Expected exception");
} catch (S3ControlException e) {
assertEquals("AccessDenied", e.awsErrorDetails().errorCode());
assertThat(e.awsErrorDetails().errorCode()).isEqualTo("AccessDenied");
assertNotNull(e.requestId());
}
}

@Test
public void getPublicAccessBlock_NoSuchPublicAccessBlock() {
try {
client.getPublicAccessBlock(r -> r.accountId(accountId));
fail("Expected exception");
} catch (S3ControlException e) {
assertThat(e.awsErrorDetails().errorCode()).isEqualTo("NoSuchPublicAccessBlockConfiguration");
assertThat(e).isInstanceOf(NoSuchPublicAccessBlockConfigurationException.class);
assertNotNull(e.requestId());
}
}

@Test
public void listJobs_InvalidRequest() {
try {
client.listJobs(r -> r.accountId(accountId).jobStatusesWithStrings("test"));
fail("Expected exception");
} catch (S3ControlException e) {
assertThat(e.awsErrorDetails().errorCode()).isEqualTo("InvalidRequest");
assertNotNull(e.requestId());
}
}

@Test
public void describeJob_InvalidRequest() {
try {
client.describeJob(r -> r.accountId(accountId).jobId("someid"));
fail("Expected exception");
} catch (S3ControlException e) {
assertThat(e.awsErrorDetails().errorCode()).isEqualTo("InvalidRequest");
assertNotNull(e.requestId());
}
}
Expand All @@ -108,7 +141,7 @@ public void deletePublicAccessBlock_NoSuchAccount() {
client.deletePublicAccessBlock(r -> r.accountId(INVALID_ACCOUNT_ID));
fail("Expected exception");
} catch (S3ControlException e) {
assertEquals("AccessDenied", e.awsErrorDetails().errorCode());
assertThat(e.awsErrorDetails().errorCode()).isEqualTo("AccessDenied");
assertNotNull(e.requestId());
}
}
Expand Down