Skip to content
Merged
Show file tree
Hide file tree
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 @@ -22,7 +22,11 @@
import org.apache.hadoop.fs.contract.AbstractContractVectoredReadTest;
import org.apache.hadoop.fs.contract.AbstractFSContract;

import java.io.IOException;
import java.io.UncheckedIOException;

import static org.apache.hadoop.fs.s3a.S3ATestUtils.enableAnalyticsAccelerator;
import static org.apache.hadoop.fs.s3a.S3ATestUtils.skipIfEncryptionSet;

/**
* S3A contract tests for vectored reads with the Analytics stream. The analytics stream does
Expand All @@ -44,6 +48,19 @@ public ITestS3AContractAnalyticsStreamVectoredRead(String bufferType) {
protected Configuration createConfiguration() {
Configuration conf = super.createConfiguration();
enableAnalyticsAccelerator(conf);

// If encryption is set, some AAL tests will fail. This is because AAL caches the head request response, and uses
// the eTag when making a GET request. When using encryption, the eTag is no longer a hash of the object content,
// and is not always the same when the same object is created multiple times. This test creates the file
// vectored_file.txt before running each test, which will have a different eTag when using encryption, leading to
// preconditioned failures. This issue is tracked in:
// https://github.com/awslabs/analytics-accelerator-s3/issues/218
try {
skipIfEncryptionSet(conf);
} catch (IOException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do this in the method itself

throw new UncheckedIOException(e);
}

conf.set("fs.contract.vector-io-early-eof-check", "false");
return conf;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class ITestS3AAnalyticsAcceleratorStreamReading extends AbstractS3ATestBa
@Before
public void setUp() throws Exception {
super.setup();
skipIfClientSideEncryption();
externalTestFile = getExternalData(getConfiguration());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@

import static org.apache.hadoop.fs.contract.ContractTestUtils.createFile;
import static org.apache.hadoop.fs.impl.FlagSet.createFlagSet;
import static org.apache.hadoop.fs.s3a.S3AEncryptionMethods.SSE_S3;
import static org.apache.hadoop.fs.s3a.impl.streams.InputStreamType.Analytics;
import static org.apache.hadoop.fs.s3a.impl.streams.InputStreamType.Prefetch;
import static org.apache.hadoop.fs.s3a.impl.CallableSupplier.submit;
Expand Down Expand Up @@ -1709,6 +1710,24 @@ public static void skipIfEncryptionNotSet(Configuration configuration,
}
}

/**
* Skip a test if encryption algorithm is not empty, or if it is set to anything other than AES256.
*
* @param configuration configuration
* @throws IOException if the secret lookup fails.
*/
public static void skipIfEncryptionSet(Configuration configuration) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

change title to skipForAnyEncryptionExceptSSES3()

String bucket = getTestBucketName(configuration);
final EncryptionSecrets secrets = buildEncryptionSecrets(bucket, configuration);
S3AEncryptionMethods s3AEncryptionMethods = secrets.getEncryptionMethod();

if (s3AEncryptionMethods.getMethod().equals(SSE_S3.getMethod()) || s3AEncryptionMethods.getMethod().isEmpty()) {
return;
}

skip("Encryption method is set to " + s3AEncryptionMethods.getMethod());
}

/**
* Get the input stream statistics of an input stream.
* Raises an exception if the inner stream is not an S3A input stream
Expand Down