From c2ec01d38c21aa87871e411eeb2dd688539bf1c1 Mon Sep 17 00:00:00 2001 From: cruizba Date: Thu, 21 Oct 2021 14:34:50 +0200 Subject: [PATCH] openvidu-server-e2e: E2E Test for mediasoup --- .../server/config/OpenviduConfig.java | 9 +- .../kurento/kms/FixedOneKmsManager.java | 10 ++ openvidu-test-e2e/jenkins/Jenkinsfile | 128 ++++++++++++------ .../e2e/AbstractOpenViduTestAppE2eTest.java | 43 ++++-- .../test/e2e/OpenViduTestAppE2eTest.java | 53 ++++---- .../test/e2e/annotations/OnlyKurento.java | 17 +++ 6 files changed, 180 insertions(+), 80 deletions(-) create mode 100644 openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/annotations/OnlyKurento.java diff --git a/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java b/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java index db40d4da..f8f1f1d2 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java +++ b/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java @@ -216,6 +216,9 @@ public class OpenviduConfig { private boolean isTurnadminAvailable = false; + // Media Server properties + private MediaServer mediaServerInfo = MediaServer.kurento; + // Plain config properties getters public String getCoturnDatabaseDbname() { @@ -271,7 +274,11 @@ public class OpenviduConfig { } public MediaServer getMediaServer() { - return MediaServer.kurento; + return this.mediaServerInfo; + } + + public void setMediaServer(MediaServer mediaServerInfo) { + this.mediaServerInfo = mediaServerInfo; } public String getOpenViduRecordingPath() { diff --git a/openvidu-server/src/main/java/io/openvidu/server/kurento/kms/FixedOneKmsManager.java b/openvidu-server/src/main/java/io/openvidu/server/kurento/kms/FixedOneKmsManager.java index a3ca27e9..7dc41750 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/kurento/kms/FixedOneKmsManager.java +++ b/openvidu-server/src/main/java/io/openvidu/server/kurento/kms/FixedOneKmsManager.java @@ -24,7 +24,9 @@ import java.util.NoSuchElementException; import javax.annotation.PostConstruct; +import io.openvidu.server.core.MediaServer; import org.kurento.client.KurentoClient; +import org.kurento.client.ServerInfo; import org.kurento.commons.exception.KurentoException; import org.kurento.jsonrpc.client.JsonRpcClientNettyWebSocket; import org.kurento.jsonrpc.client.JsonRpcWSConnectionListener; @@ -58,6 +60,14 @@ public class FixedOneKmsManager extends KmsManager { kms.setKurentoClientConnected(true); kms.setTimeOfKurentoClientConnection(System.currentTimeMillis()); + // Set Media Server in OpenVidu configuration + ServerInfo serverInfo = kms.getKurentoClient().getServerManager().getInfo(); + if (serverInfo.getVersion().startsWith("openvidu/mediasoup-controller")) { + this.openviduConfig.setMediaServer(MediaServer.mediasoup); + } else { + this.openviduConfig.setMediaServer(MediaServer.kurento); + } + } catch (KurentoException e) { log.error("KMS in {} is not reachable by OpenVidu Server", firstProps.getUri()); if (kClient != null) { diff --git a/openvidu-test-e2e/jenkins/Jenkinsfile b/openvidu-test-e2e/jenkins/Jenkinsfile index e722c6e6..e244fd70 100644 --- a/openvidu-test-e2e/jenkins/Jenkinsfile +++ b/openvidu-test-e2e/jenkins/Jenkinsfile @@ -1,6 +1,6 @@ node('container') { - sh 'docker rm -f e2e chrome firefox opera || true' + sh 'docker rm -f e2e chrome firefox opera mediasoup || true' sh 'rm -rf /opt/openvidu/* || true' sh 'wget https://github.com/OpenVidu/openvidu/raw/master/openvidu-test-e2e/docker/barcode.y4m -P /opt/openvidu' sh 'wget https://github.com/OpenVidu/openvidu/raw/master/openvidu-test-e2e/docker/fakeaudio.wav -P /opt/openvidu' @@ -10,6 +10,7 @@ node('container') { docker.image('selenium/standalone-chrome:latest').pull() docker.image('selenium/standalone-firefox:latest').pull() docker.image('selenium/standalone-opera:latest').pull() + docker.image('openvidu/mediasoup-controller:$MEDIASOUP_CONTROLLER_DOCKER_VERSION').pull() docker.image('openvidu/openvidu-test-e2e:$DISTRO').inside('--name e2e -p 4200:4200 -p 4443:4443 -p 5555:5555 -u root -e MY_UID=0 -v /var/run/docker.sock:/var/run/docker.sock:rw -v /dev/shm:/dev/shm -v /opt/openvidu:/opt/openvidu --privileged') { @@ -126,53 +127,94 @@ node('container') { '''.stripIndent()) } - stage ('Environment Launch') { - sh 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/CN=www.mydom.com/O=My Company LTD./C=US" -keyout /opt/openvidu/testapp/key.pem -out /opt/openvidu/testapp/cert.pem' - sh 'cd /opt/openvidu/testapp && http-server -S -p 4200 &> /opt/openvidu/testapp.log &' - sh '/usr/bin/kurento-media-server &> /kms.log &' - sh 'until $(curl --insecure --output /dev/null --silent http://127.0.0.1:8888/kurento); do echo "Waiting for KMS..."; sleep 1; done' - sh(script: '''#!/bin/bash -xe - if [ "$DOCKER_RECORDING_VERSION" != "default" ]; then - echo "Using custom openvidu-recording tag: $DOCKER_RECORDING_VERSION" - java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_RECORDING_VERSION=$DOCKER_RECORDING_VERSION -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log & - else - echo "Using default openvidu-recording tag" - java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log & - fi - '''.stripIndent()) - sh 'until $(curl --insecure --output /dev/null --silent --head --fail https://OPENVIDUAPP:MY_SECRET@localhost:4443/); do echo "Waiting for openvidu-server..."; sleep 2; done' - } - docker.image('selenium/standalone-chrome:latest').withRun('-p 6666:4444 --name chrome --shm-size=1g -v /opt/openvidu:/opt/openvidu') { a -> docker.image('selenium/standalone-firefox:latest').withRun('-p 6667:4444 --name firefox --shm-size=1g') { b -> docker.image('selenium/standalone-opera:latest').withRun('-p 6668:4444 --name opera --shm-size=1g') { c -> - - stage ('OpenVidu E2E tests') { - try { - sh(script: '''#!/bin/bash -xe - cd openvidu - if [[ $OPENVIDU_TESTE2E_COMMIT != "default" ]]; then - git checkout -f $OPENVIDU_TESTE2E_COMMIT - fi - cd openvidu-test-browsers - mvn --batch-mode versions:set -DnewVersion=TEST && mvn clean install - cd .. - mvn --batch-mode versions:set-property -Dproperty=version.openvidu.java.client -DnewVersion=TEST - mvn --batch-mode versions:set-property -Dproperty=version.openvidu.test.browsers -DnewVersion=TEST - cd openvidu-test-e2e - mvn -DskipTests=true clean install - sudo mvn --batch-mode -Dtest=OpenViduTestAppE2eTest -DAPP_URL=https://172.17.0.1:4200/ -DOPENVIDU_URL=https://172.17.0.1:4443/ -DREMOTE_URL_CHROME=http://172.17.0.1:6666/wd/hub/ -DREMOTE_URL_FIREFOX=http://172.17.0.1:6667/wd/hub/ -DREMOTE_URL_OPERA=http://172.17.0.1:6668/wd/hub/ -DEXTERNAL_CUSTOM_LAYOUT_URL=http://172.17.0.1:5555 -DEXTERNAL_CUSTOM_LAYOUT_PARAMS=sessionId,CUSTOM_LAYOUT_SESSION,secret,MY_SECRET test - git checkout -f $OPENVIDU_COMMIT - '''.stripIndent()) - } - finally { - junit 'openvidu/openvidu-test-e2e/**/target/surefire-reports/TEST-*.xml' - archiveArtifacts artifacts: '**/openvidu-server.log' - } + stage ('Environment Launch Kurento') { + environmentLaunch('kurento') + } + stage ('OpenVidu Kurento E2E tests') { + openViduE2ETest('kurento') + environmentStop() + } + stage ('Environment Launch Mediasoup') { + environmentLaunch('mediasoup') + } + stage ('OpenVidu Mediasoup E2E tests') { + openViduE2ETest('mediasoup') + environmentStop() } - } } } } -} \ No newline at end of file +} + +def environmentLaunch(mediaServer) { + sh 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/CN=www.mydom.com/O=My Company LTD./C=US" -keyout /opt/openvidu/testapp/key.pem -out /opt/openvidu/testapp/cert.pem' + sh 'cd /opt/openvidu/testapp && http-server -S -p 4200 &> /opt/openvidu/testapp.log &' + if (mediaServer == 'kurento') { + sh '/usr/bin/kurento-media-server &> /kms.log &' + } else if (mediaServer == 'mediasoup') { + sh(script: '''#!/bin/bash -xe + docker run --name=mediasoup --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 --network=host --restart=always --detach=true \ + openvidu/mediasoup-controller:$MEDIASOUP_CONTROLLER_DOCKER_VERSION + '''.stripIndent()) + } + script { + env.mediaServer = mediaServer + sh(script: '''#!/bin/bash -xe + KMS_IP=127.0.0.1 + if [[ "${mediaServer}" == "mediasoup" ]]; then + KMS_IP=172.17.0.1 + fi + until $(curl --insecure --output /dev/null --silent http://${KMS_IP}:8888/kurento); do echo "Waiting for ${mediaServer}..."; sleep 1; done + if [ "$DOCKER_RECORDING_VERSION" != "default" ]; then + echo "Using custom openvidu-recording tag: $DOCKER_RECORDING_VERSION" + java -jar -DKMS_URIS=[\\"ws://${KMS_IP}:8888/kurento\\"] -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_RECORDING_VERSION=$DOCKER_RECORDING_VERSION -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log & + else + echo "Using default openvidu-recording tag" + java -jar -DKMS_URIS=[\\"ws://${KMS_IP}:8888/kurento\\"] -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log & + fi + '''.stripIndent()) + } + sh 'until $(curl --insecure --output /dev/null --silent --head --fail https://OPENVIDUAPP:MY_SECRET@localhost:4443/); do echo "Waiting for openvidu-server..."; sleep 2; done' +} + +def environmentStop() { + sh 'kill -9 $(pidof kurento-media-server) || true' + sh 'kill -9 $(pgrep -f /opt/openvidu/openvidu-server) || true' + sh 'docker rm -f mediasoup || true' +} + +def openViduE2ETest(mediaServer) { + script { + env.mediaServer = mediaServer + try { + sh(script: '''#!/bin/bash -xe + cd openvidu + if [[ $OPENVIDU_TESTE2E_COMMIT != "default" ]]; then + git checkout -f $OPENVIDU_TESTE2E_COMMIT + fi + cd openvidu-test-browsers + mvn --batch-mode versions:set -DnewVersion=TEST && mvn clean install + cd .. + mvn --batch-mode versions:set-property -Dproperty=version.openvidu.java.client -DnewVersion=TEST + mvn --batch-mode versions:set-property -Dproperty=version.openvidu.test.browsers -DnewVersion=TEST + cd openvidu-test-e2e + mvn -DskipTests=true clean install + sudo mvn --batch-mode -DMEDIA_SERVER=${mediaServer} -Dtest=OpenViduTestAppE2eTest -DAPP_URL=https://172.17.0.1:4200/ -DOPENVIDU_URL=https://172.17.0.1:4443/ -DREMOTE_URL_CHROME=http://172.17.0.1:6666/wd/hub/ -DREMOTE_URL_FIREFOX=http://172.17.0.1:6667/wd/hub/ -DREMOTE_URL_OPERA=http://172.17.0.1:6668/wd/hub/ -DEXTERNAL_CUSTOM_LAYOUT_URL=http://172.17.0.1:5555 -DEXTERNAL_CUSTOM_LAYOUT_PARAMS=sessionId,CUSTOM_LAYOUT_SESSION,secret,MY_SECRET test + git checkout -f $OPENVIDU_COMMIT + '''.stripIndent()) + } catch (err) { + echo "Test failed" + } finally { + junit 'openvidu/openvidu-test-e2e/**/target/surefire-reports/TEST-*.xml' + archiveArtifacts artifacts: '**/openvidu-server.log' + } + } +} diff --git a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/AbstractOpenViduTestAppE2eTest.java b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/AbstractOpenViduTestAppE2eTest.java index 23a99e00..3e7ba928 100644 --- a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/AbstractOpenViduTestAppE2eTest.java +++ b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/AbstractOpenViduTestAppE2eTest.java @@ -46,6 +46,9 @@ import io.openvidu.test.browsers.utils.RecordingUtils; public class AbstractOpenViduTestAppE2eTest { + // Media server variables + public static String MEDIA_SERVER = "kurento"; + final protected String DEFAULT_JSON_SESSION = "{'id':'STR','object':'session','sessionId':'STR','createdAt':0,'mediaMode':'STR','recordingMode':'STR','defaultRecordingProperties':{'hasVideo':true,'frameRate':25,'hasAudio':true,'shmSize':536870912,'name':'','outputMode':'COMPOSED','resolution':'1280x720','recordingLayout':'BEST_FIT'},'customSessionId':'STR','connections':{'numberOfElements':0,'content':[]},'recording':false,'forcedVideoCodec':'STR','allowTranscoding':false}"; final protected String DEFAULT_JSON_PENDING_CONNECTION = "{'id':'STR','object':'connection','type':'WEBRTC','status':'pending','connectionId':'STR','sessionId':'STR','createdAt':0,'activeAt':null,'location':null,'ip':null,'platform':null,'token':'STR','serverData':'STR','record':true,'role':'STR','kurentoOptions':null,'rtspUri':null,'adaptativeBitrate':null,'onlyPlayWithSubscribers':null,'networkCache':null,'clientData':null,'publishers':null,'subscribers':null}"; final protected String DEFAULT_JSON_ACTIVE_CONNECTION = "{'id':'STR','object':'connection','type':'WEBRTC','status':'active','connectionId':'STR','sessionId':'STR','createdAt':0,'activeAt':0,'location':'STR','ip':'STR','platform':'STR','token':'STR','serverData':'STR','record':true,'role':'STR','kurentoOptions':null,'rtspUri':null,'adaptativeBitrate':null,'onlyPlayWithSubscribers':null,'networkCache':null,'clientData':'STR','publishers':[],'subscribers':[]}"; @@ -154,6 +157,12 @@ public class AbstractOpenViduTestAppE2eTest { OPENVIDU_SECRET = openvidusecret; } log.info("Using secret {} to connect to openvidu-server", OPENVIDU_SECRET); + + String mediaServer = System.getProperty("MEDIA_SERVER"); + if (mediaServer != null) { + MEDIA_SERVER = mediaServer; + } + log.info("Using media server {} for e2e tests"); } protected void setupBrowser(String browser) { @@ -255,7 +264,7 @@ public class AbstractOpenViduTestAppE2eTest { isRecordingTest = false; } if (isKurentoRestartTest) { - this.restartKms(); + this.restartMediaServer(); isKurentoRestartTest = false; } OV = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET); @@ -295,24 +304,38 @@ public class AbstractOpenViduTestAppE2eTest { return "data:image/png;base64," + screenshotBase64; } - protected void startKms() { - log.info("Starting KMS"); - commandLine.executeCommand("/usr/bin/kurento-media-server &>> /kms.log &"); + protected void startMediaServer() { + if ("kurento".equals(MEDIA_SERVER)) { + log.info("Starting KMS"); + commandLine.executeCommand("/usr/bin/kurento-media-server &>> /kms.log &"); + } else if ("mediasoup".equals(MEDIA_SERVER)) { + log.info("Starting MediaSoup"); + // TODO?: Test which use this method are disabled + } else { + log.error("Unrecognized MEDIA_SERVER: {}", MEDIA_SERVER); + System.exit(1); + } } - protected void stopKms() { - log.info("Stopping KMS"); - commandLine.executeCommand("kill -9 $(pidof kurento-media-server)"); + protected void stopMediaServer() { + if ("kurento".equals(MEDIA_SERVER)) { + log.info("Stopping KMS"); + commandLine.executeCommand("kill -9 $(pidof kurento-media-server)"); + } else if ("mediasoup".equals(MEDIA_SERVER)) { + log.info("Stopping mediasoup"); + commandLine.executeCommand("docker rm -f mediasoup"); + } + } - protected void restartKms() { - this.stopKms(); + protected void restartMediaServer() { + this.stopMediaServer(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } - this.startKms(); + this.startMediaServer(); } protected void checkDockerContainerRunning(String imageName, int amount) { diff --git a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java index 298db342..326d288b 100644 --- a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java +++ b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java @@ -31,13 +31,11 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import io.openvidu.java.client.*; +import io.openvidu.test.e2e.annotations.OnlyKurento; import org.apache.http.HttpStatus; import org.junit.Assert; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Tag; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.*; import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.Alert; import org.openqa.selenium.By; @@ -47,6 +45,8 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.ExpectedConditions; +import org.springframework.test.context.junit.jupiter.DisabledIf; +import org.springframework.test.context.junit.jupiter.EnabledIf; import org.springframework.test.context.junit.jupiter.SpringExtension; import com.google.gson.JsonArray; @@ -55,23 +55,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.mashape.unirest.http.HttpMethod; -import io.openvidu.java.client.Connection; -import io.openvidu.java.client.ConnectionProperties; -import io.openvidu.java.client.ConnectionType; -import io.openvidu.java.client.KurentoOptions; -import io.openvidu.java.client.MediaMode; -import io.openvidu.java.client.OpenVidu; -import io.openvidu.java.client.OpenViduHttpException; -import io.openvidu.java.client.OpenViduRole; -import io.openvidu.java.client.Publisher; -import io.openvidu.java.client.Recording; import io.openvidu.java.client.Recording.OutputMode; -import io.openvidu.java.client.RecordingLayout; -import io.openvidu.java.client.RecordingMode; -import io.openvidu.java.client.RecordingProperties; -import io.openvidu.java.client.Session; -import io.openvidu.java.client.SessionProperties; -import io.openvidu.java.client.VideoCodec; import io.openvidu.test.browsers.FirefoxUser; import io.openvidu.test.browsers.utils.CustomHttpClient; import io.openvidu.test.browsers.utils.RecordingUtils; @@ -101,7 +85,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { @Test @DisplayName("One2One Chrome [Video + Audio]") void oneToOneVideoAudioSessionChrome() throws Exception { - setupBrowser("chrome"); log.info("One2One Chrome [Video + Audio]"); @@ -249,6 +232,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Unique user remote subscription [Video + Audio]") void oneRemoteSubscription() throws Exception { @@ -274,6 +258,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Unique user remote subscription Firefox [Video + Audio]") void oneRemoteSubscriptionFirefox() throws Exception { @@ -299,6 +284,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Unique user remote subscription [ScreenShare + Audio]") void oneRemoteSubscriptionScreen() throws Exception { @@ -816,6 +802,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Stream property changed event") void streamPropertyChangedEventTest() throws Exception { @@ -1478,6 +1465,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Record cross-browser audio-only and video-only") void audioOnlyVideoOnlyRecordTest() throws Exception { isRecordingTest = true; @@ -1710,6 +1698,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Custom layout recording") void customLayoutRecordTest() throws Exception { isRecordingTest = true; @@ -1949,6 +1938,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Video filter test") void videoFilterTest() throws Exception { @@ -2092,6 +2082,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Video filter events test") void videoFilterEventsTest() throws Exception { @@ -2216,6 +2207,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("openvidu-java-client test") void openViduJavaClientTest() throws Exception { isRecordingTest = true; @@ -2743,6 +2735,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("REST API test") void restApiTest() throws Exception { isRecordingTest = true; @@ -3246,7 +3239,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { List sessions = OV.getActiveSessions(); Assert.assertEquals("Expected no active sessions but found " + sessions.size(), 0, sessions.size()); - this.stopKms(); + this.stopMediaServer(); OV.fetch(); @@ -3268,7 +3261,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { user.getDriver().findElement(By.id("remove-user-btn")).sendKeys(Keys.ENTER); - this.startKms(); + this.startMediaServer(); Thread.sleep(3000); // Connect one subscriber with connection to KMS -> restart KMS -> connect a @@ -3284,7 +3277,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { sessions = OV.getActiveSessions(); Assert.assertEquals("Expected 1 active sessions but found " + sessions.size(), 1, sessions.size()); - this.restartKms(); + this.restartMediaServer(); Thread.sleep(3000); OV.fetch(); @@ -3335,7 +3328,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { }); long recEndTime = System.currentTimeMillis(); - this.restartKms(); + this.restartMediaServer(); user.getEventManager().waitUntilEventReaches("recordingStopped", 2); user.getEventManager().waitUntilEventReaches("streamDestroyed", 2); @@ -3383,6 +3376,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Webhook test") void webhookTest() throws Exception { isRecordingTest = true; @@ -3586,6 +3580,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("IP camera test") void ipCameraTest() throws Exception { isRecordingTest = true; @@ -4078,6 +4073,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Force codec default config") void forceDefaultCodec() throws Exception { log.info("Force codec default config"); @@ -4086,6 +4082,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Force valid codec VP8 - Not Allow Transcoding") void forceValidCodecNotAllowTranscodingVP8Test() throws Exception { log.info("Force codec Chrome - Force VP8 - Not Allow Transcoding"); @@ -4095,6 +4092,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Force valid codec H264 - Not Allow Transcoding") void forceValidCodecNotAllowTranscodingH264Test() throws Exception { log.info("Force codec Chrome - Force H264 - Not Allow Transcoding"); @@ -4104,6 +4102,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Force valid codec VP8 - Allow Transcoding") void forceValidCodecAllowTranscodingVP8Test() throws Exception { log.info("Force codec Chrome - Force VP8 - Allow Transcoding"); @@ -4113,6 +4112,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Force valid codec H264 - Allow Transcoding") void forceValidCodecAllowTranscodingH264Test() throws Exception { log.info("Force codec Chrome - Force H264 - Allow Transcoding"); @@ -4122,6 +4122,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { } @Test + @OnlyKurento @DisplayName("Force not valid codec - Not Allow Transcoding") void forceCodecNotValidCodecNotAllowTranscoding() throws Exception { // Start firefox with OpenH264 disabled to check not supported codecs diff --git a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/annotations/OnlyKurento.java b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/annotations/OnlyKurento.java new file mode 100644 index 00000000..edcdaf8d --- /dev/null +++ b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/annotations/OnlyKurento.java @@ -0,0 +1,17 @@ +package io.openvidu.test.e2e.annotations; + +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; +import org.springframework.test.context.junit.jupiter.DisabledIf; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@DisabledIf(expression = "#{systemProperties['MEDIA_SERVER'].toLowerCase().equals('mediasoup')}") +public @interface OnlyKurento { + +}