diff options
author | Ganesh Chandrasekaran <ganesh.c@samsung.com> | 2019-10-07 11:38:20 +0900 |
---|---|---|
committer | Ganesh Chandrasekaran <ganesh.c@samsung.com> | 2019-10-13 23:33:26 +0000 |
commit | fe8c4ae15a2301db06f1a1b217b8db82f4716211 (patch) | |
tree | 639f254a7b75f6af2a20989f312e47e550d6ac38 /saltstack-adapter/saltstack-adapter-provider | |
parent | 13c99391e9100df582bf999f7a1a65ac8655fbc6 (diff) |
Test cases fix
Change-Id: I2de47d5c7c8b41a2e2536f9f9ffaec1193d8f5ba
Signed-off-by: Ganesh Chandrasekaran <ganesh.c@samsung.com>
Issue-ID: CCSDK-1806
Signed-off-by: Ganesh Chandrasekaran <ganesh.c@samsung.com>
Diffstat (limited to 'saltstack-adapter/saltstack-adapter-provider')
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"; |