Skip to content

Commit

Permalink
Fixed integration tests in ipv6 env (#3520)
Browse files Browse the repository at this point in the history
* make sure socat portforward on both ipv4 & v6 address
  • Loading branch information
t83714 authored Apr 29, 2024
1 parent 6c47b45 commit 05f8602
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion magda-int-test-ts/src/ServiceRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export default class ServiceRunner {
if (this.dockerServiceForwardHost) {
return;
}
this.dockerServiceForwardHost = "localhost";
const dockerHost = process?.env?.DOCKER_HOST;
if (!dockerHost) {
return;
Expand Down Expand Up @@ -377,12 +378,14 @@ export default class ServiceRunner {
`Port ${localPort} already has an existing port forwarding process running.`
);
}
const portForwardCmd = `socat TCP4-LISTEN:${localPort},fork,reuseaddr TCP4:${hostname}:${remotePort}`;
const portForwardCmd = `socat TCP6-LISTEN:${localPort},fork,reuseaddr TCP4:${hostname}:${remotePort}`;
const portForwardProcess = child_process.spawn(portForwardCmd, {
stdio: "inherit",
shell: true
});

console.log(`Started to portforward for ${hostname}:${remotePort}...`);

this.portForwardingProcessList[
localPort.toString()
] = portForwardProcess;
Expand Down

0 comments on commit 05f8602

Please sign in to comment.