From 809135082a04208f586ba7fbce705668eb559007 Mon Sep 17 00:00:00 2001 From: Mukul Kumar Singh Date: Wed, 9 May 2018 10:21:41 +0530 Subject: [PATCH] HDDS-33. Ozone : Fix the test logic in TestKeySpaceManager#testDeleteKey. Contributed by Shashikant Banerjee. --- .../org/apache/hadoop/ozone/ksm/TestKeySpaceManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ksm/TestKeySpaceManager.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ksm/TestKeySpaceManager.java index 6478e888bf..9a116b7615 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ksm/TestKeySpaceManager.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ksm/TestKeySpaceManager.java @@ -642,9 +642,12 @@ public void testDeleteKey() throws IOException, OzoneException { Assert.assertEquals(1, list.size()); // Delete the key again to test deleting non-existing key. - exception.expect(IOException.class); - exception.expectMessage("KEY_NOT_FOUND"); - storageHandler.deleteKey(keyArgs); + try { + storageHandler.deleteKey(keyArgs); + Assert.fail("Expected exception not thrown."); + } catch (IOException ioe) { + Assert.assertTrue(ioe.getMessage().contains("KEY_NOT_FOUND")); + } Assert.assertEquals(1 + numKeyDeleteFails, ksmMetrics.getNumKeyDeletesFails()); }