shameersss1 commented on code in PR #6884:
URL: https://github.com/apache/hadoop/pull/6884#discussion_r1674141230


##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AClientSideEncryption.java:
##########
@@ -266,6 +288,100 @@ public void testEncryptionEnabledAndDisabledFS() throws 
Exception {
     }
   }
 
+  /**
+   * Testing how file name with suffix ".instruction" is ignored when CSE is 
enabled
+   * based on configurations.
+   * @throws IOException
+   */
+  @Test
+  public void testEncryptionWithInstructionFile() throws IOException {
+    maybeSkipTest();
+    S3AFileSystem cseDisabledFS = new S3AFileSystem();
+    Configuration cseDisabledConf = getConfiguration();
+    S3AFileSystem cseEnabledFS = getFileSystem();
+    Path unEncryptedFilePath = path(getMethodName());
+    Path unEncryptedFile = new Path(unEncryptedFilePath,
+        "file" + S3_ENCRYPTION_CSE_INSTRUCTION_FILE_SUFFIX);
+
+    // Initialize a CSE disabled FS.
+    removeBaseAndBucketOverrides(getTestBucketName(cseDisabledConf),
+            cseDisabledConf,
+            S3_ENCRYPTION_ALGORITHM,
+            S3_ENCRYPTION_KEY,
+            SERVER_SIDE_ENCRYPTION_ALGORITHM,
+            SERVER_SIDE_ENCRYPTION_KEY);
+    cseDisabledFS.initialize(getFileSystem().getUri(),
+            cseDisabledConf);
+
+    // Unencrypted data written to a path.
+    try (FSDataOutputStream out = cseDisabledFS.create(unEncryptedFile)) {
+      out.write(new byte[SMALL_FILE_SIZE]);
+    }
+
+    // list from cse disabled FS
+    assertEquals("number of files didn't match", 1,

Review Comment:
   ack



##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AClientSideEncryption.java:
##########
@@ -266,6 +288,100 @@ public void testEncryptionEnabledAndDisabledFS() throws 
Exception {
     }
   }
 
+  /**
+   * Testing how file name with suffix ".instruction" is ignored when CSE is 
enabled
+   * based on configurations.
+   * @throws IOException
+   */
+  @Test
+  public void testEncryptionWithInstructionFile() throws IOException {
+    maybeSkipTest();
+    S3AFileSystem cseDisabledFS = new S3AFileSystem();
+    Configuration cseDisabledConf = getConfiguration();
+    S3AFileSystem cseEnabledFS = getFileSystem();
+    Path unEncryptedFilePath = path(getMethodName());
+    Path unEncryptedFile = new Path(unEncryptedFilePath,
+        "file" + S3_ENCRYPTION_CSE_INSTRUCTION_FILE_SUFFIX);
+
+    // Initialize a CSE disabled FS.
+    removeBaseAndBucketOverrides(getTestBucketName(cseDisabledConf),
+            cseDisabledConf,
+            S3_ENCRYPTION_ALGORITHM,
+            S3_ENCRYPTION_KEY,
+            SERVER_SIDE_ENCRYPTION_ALGORITHM,
+            SERVER_SIDE_ENCRYPTION_KEY);
+    cseDisabledFS.initialize(getFileSystem().getUri(),
+            cseDisabledConf);
+
+    // Unencrypted data written to a path.
+    try (FSDataOutputStream out = cseDisabledFS.create(unEncryptedFile)) {
+      out.write(new byte[SMALL_FILE_SIZE]);
+    }
+
+    // list from cse disabled FS
+    assertEquals("number of files didn't match", 1,
+            cseDisabledFS.listStatus(unEncryptedFilePath).length);
+
+    // list from cse enabled fs with skipping of instruction file
+    cseEnabledFS.getConf().setBoolean(S3_ENCRYPTION_CSE_SKIP_INSTRUCTION_FILE, 
true);
+    cseEnabledFS.initialize(getFileSystem().getUri(), cseEnabledFS.getConf());
+    assertEquals("number of files didn't match", 0,
+            cseEnabledFS.listStatus(unEncryptedFilePath).length);
+
+    // disable skipping cse instruction file.
+    cseEnabledFS.getConf().setBoolean(S3_ENCRYPTION_CSE_SKIP_INSTRUCTION_FILE, 
false);
+    cseEnabledFS.initialize(getFileSystem().getUri(), cseEnabledFS.getConf());
+    assertEquals("number of files didn't match", 1,

Review Comment:
   ack



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to