Skip to content

Commit ebd1ab0

Browse files
authored
HADOOP-19527. S3A: Skip AAL tests if encryption is set. (#7592) (#7604)
Contributed by Ahmar Suhail.
1 parent 6fb831e commit ebd1ab0

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractAnalyticsStreamVectoredRead.java

+17-4
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@
2323
import org.apache.hadoop.fs.contract.AbstractFSContract;
2424

2525
import static org.apache.hadoop.fs.s3a.S3ATestUtils.enableAnalyticsAccelerator;
26+
import static org.apache.hadoop.fs.s3a.S3ATestUtils.skipForAnyEncryptionExceptSSES3;
2627

2728
/**
28-
* S3A contract tests for vectored reads with the Analytics stream. The analytics stream does
29-
* not explicitly implement the vectoredRead() method, or currently do and vectored-read specific
30-
* optimisations (such as range coalescing). However, this test ensures that the base implementation
31-
* of readVectored {@link org.apache.hadoop.fs.PositionedReadable} still works.
29+
* S3A contract tests for vectored reads with the Analytics stream.
30+
* The analytics stream does not explicitly implement the vectoredRead() method,
31+
* or currently do and vectored-read specific optimisations
32+
* (such as range coalescing). However, this test ensures that the base
33+
* implementation of readVectored {@link org.apache.hadoop.fs.PositionedReadable}
34+
* still works.
3235
*/
3336
public class ITestS3AContractAnalyticsStreamVectoredRead extends AbstractContractVectoredReadTest {
3437

@@ -44,6 +47,16 @@ public ITestS3AContractAnalyticsStreamVectoredRead(String bufferType) {
4447
protected Configuration createConfiguration() {
4548
Configuration conf = super.createConfiguration();
4649
enableAnalyticsAccelerator(conf);
50+
// If encryption is set, some AAL tests will fail.
51+
// This is because AAL caches the head request response, and uses
52+
// the eTag when making a GET request. When using encryption, the eTag is
53+
// no longer a hash of the object content, and is not always the same when
54+
// the same object is created multiple times. This test creates the file
55+
// vectored_file.txt before running each test, which will have a
56+
// different eTag when using encryption, leading to preconditioned failures.
57+
// This issue is tracked in:
58+
// https://github.com/awslabs/analytics-accelerator-s3/issues/218
59+
skipForAnyEncryptionExceptSSES3(conf);
4760
conf.set("fs.contract.vector-io-early-eof-check", "false");
4861
return conf;
4962
}

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AAnalyticsAcceleratorStreamReading.java

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public class ITestS3AAnalyticsAcceleratorStreamReading extends AbstractS3ATestBa
7272
@Before
7373
public void setUp() throws Exception {
7474
super.setup();
75+
skipIfClientSideEncryption();
7576
externalTestFile = getExternalData(getConfiguration());
7677
}
7778

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java

+25
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106

107107
import static org.apache.hadoop.fs.contract.ContractTestUtils.createFile;
108108
import static org.apache.hadoop.fs.impl.FlagSet.createFlagSet;
109+
import static org.apache.hadoop.fs.s3a.S3AEncryptionMethods.SSE_S3;
109110
import static org.apache.hadoop.fs.s3a.impl.streams.InputStreamType.Analytics;
110111
import static org.apache.hadoop.fs.s3a.impl.streams.InputStreamType.Prefetch;
111112
import static org.apache.hadoop.fs.s3a.impl.CallableSupplier.submit;
@@ -1728,6 +1729,30 @@ public static void skipIfEncryptionNotSet(Configuration configuration,
17281729
}
17291730
}
17301731

1732+
/**
1733+
* Skip a test if encryption algorithm is not empty, or if it is set to
1734+
* anything other than AES256.
1735+
*
1736+
* @param configuration configuration
1737+
*/
1738+
public static void skipForAnyEncryptionExceptSSES3(Configuration configuration) {
1739+
String bucket = getTestBucketName(configuration);
1740+
try {
1741+
final EncryptionSecrets secrets = buildEncryptionSecrets(bucket, configuration);
1742+
S3AEncryptionMethods s3AEncryptionMethods = secrets.getEncryptionMethod();
1743+
1744+
if (s3AEncryptionMethods.getMethod().equals(SSE_S3.getMethod())
1745+
|| s3AEncryptionMethods.getMethod().isEmpty()) {
1746+
return;
1747+
}
1748+
1749+
skip("Encryption method is set to " + s3AEncryptionMethods.getMethod());
1750+
} catch (IOException e) {
1751+
throw new UncheckedIOException(e);
1752+
}
1753+
1754+
}
1755+
17311756
/**
17321757
* Get the input stream statistics of an input stream.
17331758
* Raises an exception if the inner stream is not an S3A input stream

0 commit comments

Comments
 (0)