You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2018/01/17 19:11:49 UTC

[GitHub] keith-turner commented on a change in pull request #315: ACCUMULO-4731 Improve exception handling if a key encryption key cannot be loaded

keith-turner commented on a change in pull request #315: ACCUMULO-4731 Improve exception handling if a key encryption key cannot be loaded
URL: https://github.com/apache/accumulo/pull/315#discussion_r162149498
 
 

 ##########
 File path: core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java
 ##########
 @@ -378,6 +388,68 @@ public void testKeyWrapAndUnwrap() throws NoSuchAlgorithmException, NoSuchPaddin
   }
 
   @Test
+  public void testKeyEncryptionKeyCatchCorrectlyUsesValidKEKFile() throws IOException {
+    kekWorks = createKekFile("kekWorks.kek", 16);
+    testKekFile(kekWorks);
+  }
+
+  @Test
+  public void testKeyEncryptionKeyCacheCorrectlyFailsWithInvalidLongKEKFile() throws IOException {
+    kekTooLong = createKekFile("kekTooLong.kek", 8);
+    exception.expect(IOException.class);
+    testKekFile(kekTooLong);
+  }
+
+  @Test
+  public void testKeyEncryptionKeyCacheCorrectlyFailsWithInvalidShortKEKFile() throws IOException {
+    kekTooShort = createKekFile("kekTooShort.kek", 32);
+    exception.expect(IOException.class);
+    testKekFile(kekTooShort);
+  }
+
+  @AfterClass
+  public static void removeAllTestKekFiles() throws IOException {
+	Files.deleteIfExists(kekWorks.toPath());
 
 Review comment:
   Its possible that `kekWorks` could be null and a NPE would happen here.  Personally I don't think this method is needed.  The files are in target, small, and unique per test run.   Also `mvn clean` will clear them out.  I am not opposed to having this method though.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services