diff options
Diffstat (limited to 'saltstack-adapter/saltstack-adapter-provider/src')
2 files changed, 29 insertions, 2 deletions
diff --git a/saltstack-adapter/saltstack-adapter-provider/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/ConnectionBuilder.java b/saltstack-adapter/saltstack-adapter-provider/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/ConnectionBuilder.java index 9f1799821..48469fdd5 100644 --- a/saltstack-adapter/saltstack-adapter-provider/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/ConnectionBuilder.java +++ b/saltstack-adapter/saltstack-adapter-provider/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/ConnectionBuilder.java @@ -134,6 +134,9 @@ public class ConnectionBuilder { return result; } + /** + * Print Reasonable error messages based on SSH Exit status code + * */ public SaltstackResult sortExitStatus(int exitStatus, String errMess, String cmd) { SaltstackResult result = new SaltstackResult(); if (exitStatus == 255 || exitStatus == 1) { diff --git a/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestConnectionBuilder.java b/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestConnectionBuilder.java index 8cd7af25e..71fcf3454 100644 --- a/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestConnectionBuilder.java +++ b/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestConnectionBuilder.java @@ -87,6 +87,30 @@ public class TestConnectionBuilder { } @Test + public void reqExecCommand_exitStatus67() { + + int exitStatus = 67; + String errFilePath = "src/test/resources/test.json"; + String command = "test"; + + SaltstackResult result = connBuilder.sortExitStatus(exitStatus, errFilePath, command); + int status = result.getStatusCode(); + assertEquals(610, status); + } + + @Test + public void reqExecCommand_exitStatus73() { + + int exitStatus = 73; + String errFilePath = "src/test/resources/test.json"; + String command = "test"; + + SaltstackResult result = connBuilder.sortExitStatus(exitStatus, errFilePath, command); + int status = result.getStatusCode(); + assertEquals(610, status); + } + + @Test public void reqExecCommand_exitStatus5() { int exitStatus = 5; @@ -111,7 +135,7 @@ public class TestConnectionBuilder { } @Test - public void reqExecCommand_exitStatus67() { + public void reqExecCommand_exitStatus67613() { int exitStatus = 5; String errFilePath = "src/test/resources/test.json"; @@ -123,7 +147,7 @@ public class TestConnectionBuilder { } @Test - public void reqExecCommand_exitStatus73() { + public void reqExecCommand_exitStatus65613() { int exitStatus = 65; String errFilePath = "src/test/resources/test.json"; |