diff --git a/src/main/java/io/hyperfoil/tools/qdup/shell/AbstractShell.java b/src/main/java/io/hyperfoil/tools/qdup/shell/AbstractShell.java index 757c5f31..e63ecf98 100644 --- a/src/main/java/io/hyperfoil/tools/qdup/shell/AbstractShell.java +++ b/src/main/java/io/hyperfoil/tools/qdup/shell/AbstractShell.java @@ -226,7 +226,7 @@ public boolean connect(){ return false; } if(getHost().isShell()){ - shConnecting("unset PROMPT_COMMAND; export PS1='" + PROMPT + "'; set +o history; export HISTCONTROL=\"ignoreboth\""); + shConnecting("unset PROMPT_COMMAND; export PS1='" + PROMPT + "'; set +o history; export HISTCONTROL=\"ignoreboth\"; unset PS0;"); } if(setupCommand !=null && !setupCommand.trim().isEmpty()){ shConnecting(setupCommand); diff --git a/src/main/java/io/hyperfoil/tools/qdup/stream/MultiStream.java b/src/main/java/io/hyperfoil/tools/qdup/stream/MultiStream.java index 63980405..60e51385 100755 --- a/src/main/java/io/hyperfoil/tools/qdup/stream/MultiStream.java +++ b/src/main/java/io/hyperfoil/tools/qdup/stream/MultiStream.java @@ -19,7 +19,9 @@ public class MultiStream extends OutputStream{ final static XLogger logger = XLoggerFactory.getXLogger(MethodHandles.lookup().lookupClass()); - + public static String printByteCharacters(String input){ + return printByteCharacters(input.getBytes(),0,input.getBytes().length); + } public static String printByteCharacters(byte b[], int off, int len){ String spaces = " "; StringBuilder bytes = new StringBuilder(); diff --git a/src/test/java/io/hyperfoil/tools/qdup/LocalTest.java b/src/test/java/io/hyperfoil/tools/qdup/LocalTest.java index 701622ef..02222fdd 100644 --- a/src/test/java/io/hyperfoil/tools/qdup/LocalTest.java +++ b/src/test/java/io/hyperfoil/tools/qdup/LocalTest.java @@ -335,6 +335,8 @@ public void local_container_download_file(){ new SecretFilter(), false ); + assertTrue("shell should be open",shell.isOpen()); + assertTrue("shell should be ready",shell.isReady()); String response = shell.shSync("echo 'foo' > /tmp/foo.txt"); response = shell.shSync("ls -al /tmp/foo.txt"); File toRead = null; diff --git a/src/test/java/io/hyperfoil/tools/qdup/RunTest.java b/src/test/java/io/hyperfoil/tools/qdup/RunTest.java index 51e492af..4594b530 100644 --- a/src/test/java/io/hyperfoil/tools/qdup/RunTest.java +++ b/src/test/java/io/hyperfoil/tools/qdup/RunTest.java @@ -75,6 +75,43 @@ public void append(LogEvent event) { " - hello-world" ); + @Test + public void test_stuck_fedora40(){ + Parser parser = Parser.getInstance(); + RunConfigBuilder builder = getBuilder(); + builder.loadYaml(parser.loadFile("signal",stream( + """ + scripts: + start-script: + - log: "Running script" + - sh: echo "Hello World!" + - log: "Finished script" + + hosts: + target-host: ${{HOST}} + + roles: + db: + hosts: + - target-host + setup-scripts: + - start-script + + states: + HOST: LOCAL + """ + + ))); + RunConfig config = builder.buildConfig(parser); + assertFalse("runConfig errors:\n" + config.getErrorStrings().stream().collect(Collectors.joining("\n")), config.hasErrors()); + + Dispatcher dispatcher = new Dispatcher(); + Run doit = new Run(tmpDir.toString(), config, dispatcher); + doit.run(); + + State state = config.getState(); + } + @Test(timeout = 40_000) public void waitfor_never_signaled(){ Parser parser = Parser.getInstance(); diff --git a/src/test/java/io/hyperfoil/tools/qdup/shell/LocalShellTest.java b/src/test/java/io/hyperfoil/tools/qdup/shell/LocalShellTest.java index ae8548a1..6ece8a95 100644 --- a/src/test/java/io/hyperfoil/tools/qdup/shell/LocalShellTest.java +++ b/src/test/java/io/hyperfoil/tools/qdup/shell/LocalShellTest.java @@ -29,6 +29,26 @@ public void sh_without_connect(){ fail("should not throw exception: "+e.getMessage()); } } + @Test + public void sh_rsync(){ + Host host = new Host(); + AbstractShell shell = new LocalShell( + host, + "", + new ScheduledThreadPoolExecutor(2), + new SecretFilter(), + false + ); + boolean connected = shell.connect(); + if(!connected){ + fail("failed to connect shell"); + } + assertTrue("shell should be open",shell.isOpen()); + assertTrue("shell should be ready",shell.isReady()); + + String exec = shell.shSync("rsync"); + assertFalse("rsync should be found by the local shell",exec.contains("command not found")); + } @Test public void sh_createFile(){