Skip to content

Commit 242b620

Browse files
committed
skip AAL tests if encryption is set
1 parent 0dac3d2 commit 242b620

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
import org.apache.hadoop.fs.contract.AbstractContractVectoredReadTest;
2323
import org.apache.hadoop.fs.contract.AbstractFSContract;
2424

25+
import java.io.IOException;
26+
import java.io.UncheckedIOException;
27+
2528
import static org.apache.hadoop.fs.s3a.S3ATestUtils.enableAnalyticsAccelerator;
29+
import static org.apache.hadoop.fs.s3a.S3ATestUtils.skipIfEncryptionSet;
2630

2731
/**
2832
* S3A contract tests for vectored reads with the Analytics stream. The analytics stream does
@@ -44,6 +48,19 @@ public ITestS3AContractAnalyticsStreamVectoredRead(String bufferType) {
4448
protected Configuration createConfiguration() {
4549
Configuration conf = super.createConfiguration();
4650
enableAnalyticsAccelerator(conf);
51+
52+
// If encryption is set, some AAL tests will fail. This is because AAL caches the head request response, and uses
53+
// the eTag when making a GET request. When using encryption, the eTag is no longer a hash of the object content,
54+
// and is not always the same when the same object is created multiple times. This test creates the file
55+
// vectored_file.txt before running each test, which will have a different eTag when using encryption, leading to
56+
// preconditioned failures. This issue is tracked in:
57+
// https://github.com/awslabs/analytics-accelerator-s3/issues/218
58+
try {
59+
skipIfEncryptionSet(conf);
60+
} catch (IOException e) {
61+
throw new UncheckedIOException(e);
62+
}
63+
4764
conf.set("fs.contract.vector-io-early-eof-check", "false");
4865
return conf;
4966
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public class ITestS3AAnalyticsAcceleratorStreamReading extends AbstractS3ATestBa
6969
@Before
7070
public void setUp() throws Exception {
7171
super.setup();
72+
skipIfClientSideEncryption();
7273
externalTestFile = getExternalData(getConfiguration());
7374
}
7475

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105

106106
import static org.apache.hadoop.fs.contract.ContractTestUtils.createFile;
107107
import static org.apache.hadoop.fs.impl.FlagSet.createFlagSet;
108+
import static org.apache.hadoop.fs.s3a.S3AEncryptionMethods.SSE_S3;
108109
import static org.apache.hadoop.fs.s3a.impl.streams.InputStreamType.Analytics;
109110
import static org.apache.hadoop.fs.s3a.impl.streams.InputStreamType.Prefetch;
110111
import static org.apache.hadoop.fs.s3a.impl.CallableSupplier.submit;
@@ -1709,6 +1710,24 @@ public static void skipIfEncryptionNotSet(Configuration configuration,
17091710
}
17101711
}
17111712

1713+
/**
1714+
* Skip a test if encryption algorithm is not empty, or if it is set to anything other than AES256.
1715+
*
1716+
* @param configuration configuration
1717+
* @throws IOException if the secret lookup fails.
1718+
*/
1719+
public static void skipIfEncryptionSet(Configuration configuration) throws IOException {
1720+
String bucket = getTestBucketName(configuration);
1721+
final EncryptionSecrets secrets = buildEncryptionSecrets(bucket, configuration);
1722+
S3AEncryptionMethods s3AEncryptionMethods = secrets.getEncryptionMethod();
1723+
1724+
if (s3AEncryptionMethods.getMethod().equals(SSE_S3.getMethod()) || s3AEncryptionMethods.getMethod().isEmpty()) {
1725+
return;
1726+
}
1727+
1728+
skip("Encryption method is set to " + s3AEncryptionMethods.getMethod());
1729+
}
1730+
17121731
/**
17131732
* Get the input stream statistics of an input stream.
17141733
* Raises an exception if the inner stream is not an S3A input stream

0 commit comments

Comments
 (0)