Repository: jclouds
Updated Branches:
  refs/heads/master 050f8e73d -> a918550e5


Uses default password with conflictive characters


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/bdb9a3af
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/bdb9a3af
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/bdb9a3af

Branch: refs/heads/master
Commit: bdb9a3af8b8811b5adb06be5ff1bfc00402ec95d
Parents: 050f8e7
Author: Dani Estevez <cont...@danielestevez.com>
Authored: Mon May 14 16:43:17 2018 -0400
Committer: Ignasi Barrera <n...@apache.org>
Committed: Thu May 17 09:12:02 2018 +0200

----------------------------------------------------------------------
 .../compute/callables/RunScriptOnNodeUsingSshTest.java | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/bdb9a3af/compute/src/test/java/org/jclouds/compute/callables/RunScriptOnNodeUsingSshTest.java
----------------------------------------------------------------------
diff --git 
a/compute/src/test/java/org/jclouds/compute/callables/RunScriptOnNodeUsingSshTest.java
 
b/compute/src/test/java/org/jclouds/compute/callables/RunScriptOnNodeUsingSshTest.java
index e8201c9..8e47d23 100644
--- 
a/compute/src/test/java/org/jclouds/compute/callables/RunScriptOnNodeUsingSshTest.java
+++ 
b/compute/src/test/java/org/jclouds/compute/callables/RunScriptOnNodeUsingSshTest.java
@@ -42,6 +42,8 @@ public class RunScriptOnNodeUsingSshTest {
    private NodeMetadata node;
    private Function<NodeMetadata, SshClient> sshFactory;
 
+   private static String testPassword = "wit h(char%special";
+
    @BeforeMethod(groups = { "unit" })
    public void init() {
       sshClient = createMock(SshClient.class);
@@ -52,7 +54,8 @@ public class RunScriptOnNodeUsingSshTest {
          }
       };
       node = createMock(NodeMetadata.class);
-      
expect(node.getCredentials()).andReturn(LoginCredentials.builder().user("tester").password("notalot").build()).atLeastOnce();
+      
expect(node.getCredentials()).andReturn(LoginCredentials.builder().user("tester").password(testPassword).build())
+            .atLeastOnce();
       replay(node);
    }
 
@@ -92,7 +95,8 @@ public class RunScriptOnNodeUsingSshTest {
 
    public void simpleRootTestWithSudoPassword() {
       node = createMock(NodeMetadata.class);
-      
expect(node.getCredentials()).andReturn(LoginCredentials.builder().user("tester").password("testpassword!").authenticateSudo(true).build())
+      expect(node.getCredentials())
+            
.andReturn(LoginCredentials.builder().user("tester").password(testPassword).authenticateSudo(true).build())
             .atLeastOnce();
       replay(node);
       RunScriptOnNodeUsingSsh testMe = new RunScriptOnNodeUsingSsh(sshFactory, 
eventBus, node, exec("echo $USER\necho $USER"),
@@ -102,8 +106,7 @@ public class RunScriptOnNodeUsingSshTest {
       sshClient.connect();
       expect(sshClient.getUsername()).andReturn("tester");
       expect(sshClient.getHostAddress()).andReturn("somewhere.example.com");
-      expect(
-            sshClient.exec("sudo -S sh <<'RUN_SCRIPT_AS_ROOT_SSH'\n" + 
"'testpassword!'\n" + "echo $USER\n"
+      expect(sshClient.exec("sudo -S sh <<'RUN_SCRIPT_AS_ROOT_SSH'\n" + "'" + 
testPassword + "'\n" + "echo $USER\n"
                   + "echo $USER\n" + 
"RUN_SCRIPT_AS_ROOT_SSH\n")).andReturn(new ExecResponse("root\nroot\n", null, 
0));
       sshClient.disconnect();
       replay(sshClient);
@@ -113,7 +116,7 @@ public class RunScriptOnNodeUsingSshTest {
 
    public void testUserAddAsRoot() {
       RunScriptOnNodeUsingSsh testMe = new RunScriptOnNodeUsingSsh(sshFactory, 
eventBus, node, UserAdd.builder()
-            .login("testuser").build(), 
wrapInInitScript(false).runAsRoot(true).overrideLoginPassword("test"));
+            .login("testuser").build(), 
wrapInInitScript(false).runAsRoot(true).overrideLoginPassword(testPassword));
 
       testMe.init();
 

Reply via email to