Skip to content

Commit

Permalink
fix local linux connect for newer kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
willr3 committed Jan 27, 2024
1 parent f24e67d commit f89d08e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/main/java/io/hyperfoil/tools/qdup/Host.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ public class Host {
public static final List<String> PODMAN_FILE_SIZE = Arrays.asList("podman exec ${{container}} du -bc ${{source}} | grep total | cut -d '\t' -f1");
public static final List<String> DOCKER_FILE_SIZE = Arrays.asList("docker exec ${{container}} du -bc ${{source}} | grep total | cut -d '\t' -f1");


public static final List<String> LOCAL_LINUX_CONNECT_SHELL = Arrays.asList("script", "-q", "/dev/null","/bin/bash");
//worked on old fedora but not on fedora 39
//public static final List<String> LOCAL_LINUX_CONNECT_SHELL = Arrays.asList("script", "-q", "/dev/null","/bin/bash");
public static final List<String> LOCAL_LINUX_CONNECT_SHELL = Arrays.asList("script", "-q","-c","/bin/bash","/dev/null");
//LOCAL_EXEC uses System.getRuntime().exec(...)
public static final List<String> LOCAL_LINUX_UPLOAD = Arrays.asList("cp","-r","${{source}}","${{destination}}");
public static final List<String> LOCAL_LINUX_DOWNLOAD = Arrays.asList("cp","-r","${{source}}","${{destination}}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public void postConnect(){
}else{
String unameN = shSync("uname -n");
if(!unameN.equals(getHost().getContainerId())){
logger.error("container Id changed for "+getHost().getSafeString());
logger.error("container Id changed for "+getHost().getSafeString()+" "+unameN);
//getHost().setContainerId(unameN);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/hyperfoil/tools/qdup/shell/LocalShell.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ PrintStream connectShell() {
} catch (IOException e) {
logger.error(getName()+" error reading from shell stream",e);
}
logger.info("{} reader thread is stopping",getName());
logger.debug("{} local reader thread is stopping len={} connectCounter={} count={}",getName(),len,connectCounter.get(),count);
});
readerThread.setDaemon(false);
readerThread.start();
Expand Down Expand Up @@ -112,7 +112,7 @@ public void exec(String command, Consumer<String> callback) {
} catch (IOException e) {
logger.error(getName()+" error reading from shell stream",e);
}
logger.info("{} reader thread is stopping",getName());
logger.debug("{} reader thread is stopping",getName());
});
t.setDaemon(false);
t.start();
Expand Down
6 changes: 2 additions & 4 deletions src/test/java/io/hyperfoil/tools/qdup/LocalTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.hyperfoil.tools.qdup;

import io.hyperfoil.tools.qdup.config.yaml.HostDefinition;
import io.hyperfoil.tools.qdup.config.yaml.HostDefinitionConstruct;
import io.hyperfoil.tools.qdup.config.yaml.Parser;
import io.hyperfoil.tools.qdup.shell.AbstractShell;
import io.hyperfoil.tools.qdup.shell.ContainerShell;
Expand All @@ -13,12 +12,9 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.FileAttribute;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.junit.Assert.*;

Expand Down Expand Up @@ -382,6 +378,7 @@ public void remote_container_download_file(){
String response = shell.shSync("echo 'foo' > /tmp/foo.txt");
response = shell.shSync("ls -al /tmp/foo.txt");
Local local = new Local(getBuilder().buildConfig(Parser.getInstance()));
//this is erorring if something else created /tmp/foo.txt, need to use a unique name
assertFalse("/tmp/foo.txt should not exist in testcontainer",exists("/tmp/foo.txt"));
try{

Expand Down Expand Up @@ -416,6 +413,7 @@ public void remote_container_download_folder(){
response = shell.shSync("echo 'bar' > "+containerDir+"/bar.txt");
response = shell.shSync("ls -al "+containerDir);
Local local = new Local(getBuilder().buildConfig(Parser.getInstance()));
//this is erorring if something else created /tmp/foo.txt, need to use a unique name
assertFalse("/tmp/foo.txt should not exist in testcontainer",exists("/tmp/foo.txt"));
try{

Expand Down

0 comments on commit f89d08e

Please sign in to comment.