Skip to content

Commit

Permalink
openvidu-test-e2e: fix docker run command to launch mediasoup-control…
Browse files Browse the repository at this point in the history
…ler storing logs
  • Loading branch information
pabloFuente committed Sep 20, 2023
1 parent 169df43 commit c24ad58
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ci-scripts/openvidu-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function environmentLaunch {
fi
done
elif [[ "${MEDIA_SERVER}" == "mediasoup" ]]; then
LOG_DATE=$(printf '%(%Y-%m-%d-%H:%M:%S)T')
LOG_DATE=$(printf '%(%Y-%m-%d-%H-%M-%S)T')
docker run --network=host --restart=always \
--env=KMS_MIN_PORT=40000 \
--env=KMS_MAX_PORT=65535 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ public class CommandLineExecutor {
* WARNING: does not work with subshell. i.e: echo $(VARIABLE)
*/
public String executeCommand(String command, int secondsTimeout) {
return this.executeCommand(command, false, secondsTimeout);
}

/**
* WARNING: does not work with subshell. i.e: echo $(VARIABLE)
*/
public String executeCommand(String command, boolean useBash, int secondsTimeout) {
String output = "";
Process p = null;
try {
p = Runtime.getRuntime().exec((new String[] { "/bin/sh", "-c", command }));
p = Runtime.getRuntime().exec((new String[] { "/bin/" + (useBash ? "bash" : "sh"), "-c", command }));
if (!p.waitFor(secondsTimeout, TimeUnit.SECONDS)) {
System.err.println("Command " + command + " did not completed in " + secondsTimeout + " seconds");
p.destroyForcibly();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,16 +638,17 @@ protected void startMediaServer(boolean waitUntilKurentoClientReconnection) {
+ " --volume=/opt/openvidu/recordings:/opt/openvidu/recordings " + MEDIA_SERVER_IMAGE;
} else if (MEDIA_SERVER_IMAGE.startsWith(MEDIASOUP_IMAGE)) {
log.info("Starting mediaSoup");
command = "LOG_DATE=$(printf '%(%Y-%m-%d-%H:%M:%S)T'); docker run --network=host --restart=always --env=KMS_MIN_PORT=40000 --env=KMS_MAX_PORT=65535"
command = "LOG_DATE=$(printf '%(%Y-%m-%d-%H-%M-%S)T'); docker run --network=host --restart=always --env=KMS_MIN_PORT=40000 --env=KMS_MAX_PORT=65535"
+ " --env=OPENVIDU_PRO_LICENSE=" + OPENVIDU_PRO_LICENSE + " --env=OPENVIDU_PRO_LICENSE_API="
+ OPENVIDU_PRO_LICENSE_API
+ " --env=WEBRTC_LISTENIPS_0_ANNOUNCEDIP=172.17.0.1 --env=WEBRTC_LISTENIPS_0_IP=172.17.0.1"
+ " --volume=/opt/openvidu/recordings:/opt/openvidu/recordings " + MEDIA_SERVER_IMAGE + " >& /opt/openvidu/mediasoup-controller-${LOG_DATE}.log &";
+ " --volume=/opt/openvidu/recordings:/opt/openvidu/recordings " + MEDIA_SERVER_IMAGE
+ " >& /opt/openvidu/mediasoup-controller-${LOG_DATE}.log &";
} else {
log.error("Unrecognized MEDIA_SERVER_IMAGE: {}", MEDIA_SERVER_IMAGE);
System.exit(1);
}
commandLine.executeCommand(command, 60);
commandLine.executeCommand(command, true, 60);
if (waitUntilKurentoClientReconnection) {
try {
Thread.sleep(5000);
Expand Down

0 comments on commit c24ad58

Please sign in to comment.