From d08a5387778a85e7f47d76ad47da775caa55e489 Mon Sep 17 00:00:00 2001 From: Arpit Agarwal Date: Tue, 9 Oct 2018 11:04:43 -0700 Subject: [PATCH] HDDS-590. Add unit test for HDDS-583. Contributed by Namit Maheshwari. (cherry picked from commit 03d66b1f5d8936e8006b87511af7a647ed1c3fcd) --- .../hadoop/ozone/TestStorageContainerManager.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java index ac3ad5d3fa4..c3c5d04f44b 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java @@ -58,6 +58,7 @@ import org.apache.hadoop.ozone.protocol.commands.DeleteBlocksCommand; import org.apache.hadoop.ozone.protocol.commands.SCMCommand; import org.apache.hadoop.test.GenericTestUtils; +import org.apache.hadoop.util.ExitUtil; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; @@ -436,6 +437,18 @@ public void testSCMInitializationFailure() throws IOException { StorageContainerManager.createSCM(null, conf); } + @Test + public void testSCMInitializationReturnCode() throws IOException { + ExitUtil.disableSystemExit(); + OzoneConfiguration conf = new OzoneConfiguration(); + conf.setBoolean(OzoneConfigKeys.OZONE_ENABLED, true); + // Set invalid args + String[] invalidArgs = {"--zxcvbnm"}; + exception.expect(ExitUtil.ExitException.class); + exception.expectMessage("ExitException"); + StorageContainerManager.createSCM(invalidArgs, conf); + } + @Test public void testScmInfo() throws Exception { OzoneConfiguration conf = new OzoneConfiguration();