diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/getconf.robot b/hadoop-ozone/dist/src/main/smoketest/basic/getconf.robot index ea61c8eab302..4dc92b149542 100644 --- a/hadoop-ozone/dist/src/main/smoketest/basic/getconf.robot +++ b/hadoop-ozone/dist/src/main/smoketest/basic/getconf.robot @@ -14,20 +14,33 @@ # limitations under the License. *** Settings *** -Documentation Smoketest ozone cluster startup -Library OperatingSystem -Resource ../commonlib.robot +Documentation Test 'ozone getconf' command +Resource ../lib/os.robot Test Timeout 5 minutes *** Test Cases *** -Ozone getconf OM - ${result} = Execute ozone getconf ozonemanagers - Should contain ${result} om +Get OM + ${result} = Execute ozone getconf ozonemanagers + Should contain ${result} om + ${result} = Execute ozone getconf -ozonemanagers + Should contain ${result} om -Ozone getconf SCM - ${result} = Execute ozone getconf storagecontainermanagers - Should contain ${result} scm +Get SCM + ${result} = Execute ozone getconf storagecontainermanagers + Should contain ${result} scm + ${result} = Execute ozone getconf -storagecontainermanagers + Should contain ${result} scm -Ozone getconf configration keys - ${result} = Execute ozone getconf confKey endpoint.token - Should contain ${result} Configuration endpoint.token is missing \ No newline at end of file +Get existing config key + ${result} = Execute ozone getconf confKey ozone.om.address + Should contain ${result} om + Should not contain ${result} is missing + ${result} = Execute ozone getconf -confKey ozone.om.address + Should contain ${result} om + Should not contain ${result} is missing + +Get undefined config key + ${result} = Execute and checkrc ozone getconf confKey no-such-config-key 255 + Should contain ${result} Configuration no-such-config-key is missing + ${result} = Execute and checkrc ozone getconf -confKey no-such-config-key 255 + Should contain ${result} Configuration no-such-config-key is missing diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/PrintConfKeyCommandHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/PrintConfKeyCommandHandler.java index d5106e643528..60c8585add0d 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/PrintConfKeyCommandHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/PrintConfKeyCommandHandler.java @@ -44,7 +44,8 @@ public Void call() throws Exception { if (value != null) { tool.printOut(value); } else { - tool.printError("Configuration " + confKey + " is missing."); + throw new IllegalArgumentException( + "Configuration " + confKey + " is missing."); } return null; }