Skip to content

Commit

Permalink
enable test for cse and expect failure
Browse files Browse the repository at this point in the history
  • Loading branch information
shameersss1 committed Nov 20, 2024
1 parent cffc4ae commit 9b7f17a
Showing 1 changed file with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.contract.ContractTestUtils;
import org.apache.hadoop.fs.s3a.AWSClientIOException;
import org.apache.hadoop.fs.s3a.S3AFileSystem;
import org.apache.hadoop.fs.s3a.commit.files.SinglePendingCommit;
import org.apache.hadoop.fs.s3a.commit.impl.CommitContext;
Expand Down Expand Up @@ -188,7 +189,6 @@ public void testPutRecovery() throws Throwable {
*/
@Test
public void testMagicWriteRecovery() throws Throwable {
skipIfClientSideEncryption();
describe("test magic write recovery with multipart uploads");
final S3AFileSystem fs = getFileSystem();

Expand All @@ -200,13 +200,28 @@ public void testMagicWriteRecovery() throws Throwable {
MAGIC_PATH_PREFIX + buffer + "/" + BASE + "/file.txt");

SdkFaultInjector.setEvaluator(SdkFaultInjector::isPartUpload);
final FSDataOutputStream out = fs.create(path);

// set the failure count again
SdkFaultInjector.setRequestFailureCount(2);

out.writeUTF("utfstring");
out.close();
boolean isExceptionThrown = false;
try {
final FSDataOutputStream out = fs.create(path);

// set the failure count again
SdkFaultInjector.setRequestFailureCount(2);

out.writeUTF("utfstring");
out.close();
} catch (AWSClientIOException exception) {
if (!fs.isCSEEnabled()) {
throw exception;
}
isExceptionThrown = true;
}
// Retrying MPU is not supported when CSE is enabled.
// Hence, it is expected to throw exception in that case.
if (fs.isCSEEnabled()) {
Assertions.assertThat(isExceptionThrown)
.describedAs("Exception should be thrown when CSE is enabled")
.isTrue();
}
}

/**
Expand Down

0 comments on commit 9b7f17a

Please sign in to comment.