Skip to content

Commit

Permalink
fix fedora 40 LOCAL failures by unsetting PS0
Browse files Browse the repository at this point in the history
  • Loading branch information
willr3 committed Jun 6, 2024
1 parent f0d587d commit 371d2ca
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/io/hyperfoil/tools/qdup/LocalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
37 changes: 37 additions & 0 deletions src/test/java/io/hyperfoil/tools/qdup/RunTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
20 changes: 20 additions & 0 deletions src/test/java/io/hyperfoil/tools/qdup/shell/LocalShellTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down

0 comments on commit 371d2ca

Please sign in to comment.