mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: relax synchronization of browser launch
parent
c67e820e93
commit
09cf208f73
|
|
@ -14,10 +14,10 @@ import java.security.KeyManagementException;
|
|||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
|
@ -116,8 +116,8 @@ public class OpenViduTestE2e {
|
|||
protected static final CommandLineExecutor commandLine = new CommandLineExecutor();
|
||||
protected static final String RECORDING_IMAGE = "openvidu/openvidu-recording";
|
||||
|
||||
protected Collection<BrowserUser> browserUsers = new HashSet<>();
|
||||
protected static Collection<GenericContainer<?>> containers = new HashSet<>();
|
||||
protected Collection<BrowserUser> browserUsers = ConcurrentHashMap.newKeySet();
|
||||
protected static Collection<GenericContainer<?>> containers = ConcurrentHashMap.newKeySet();
|
||||
|
||||
protected static RoomServiceClient LK;
|
||||
protected static IngressServiceClient LK_INGRESS;
|
||||
|
|
@ -512,8 +512,11 @@ public class OpenViduTestE2e {
|
|||
return browserUser;
|
||||
}
|
||||
|
||||
private static synchronized boolean setupBrowserAux(BrowserNames browser, GenericContainer<?> container, boolean forceRestart) {
|
||||
private static final Map<BrowserNames, Object> browserSetupLocks = new ConcurrentHashMap<>();
|
||||
|
||||
private static boolean setupBrowserAux(BrowserNames browser, GenericContainer<?> container, boolean forceRestart) {
|
||||
if (isRemote(browser)) {
|
||||
synchronized (browserSetupLocks.computeIfAbsent(browser, b -> new Object())) {
|
||||
String dockerImage = container.getDockerImageName();
|
||||
String ps = commandLine.executeCommand("docker ps | grep " + dockerImage, 30);
|
||||
boolean containerAlreadyRunning = container.isRunning() || !ps.isBlank();
|
||||
|
|
@ -526,6 +529,7 @@ public class OpenViduTestE2e {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1338,7 +1338,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
|||
final java.util.concurrent.atomic.AtomicLong subscriber1920AtMs = new java.util.concurrent.atomic.AtomicLong(
|
||||
-1);
|
||||
|
||||
final String publisherBrowser = subscriberBrowser == "chromeTwoInstances" ? "chromeTwoInstances" : "chrome";
|
||||
final String publisherBrowser = "chromeTwoInstances".equals(subscriberBrowser) ? "chromeTwoInstances" : "chrome";
|
||||
|
||||
Future<?> task1 = executor.submit(() -> {
|
||||
try {
|
||||
|
|
@ -3590,13 +3590,14 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
|||
Assertions.fail(errMsg);
|
||||
}
|
||||
} finally {
|
||||
// Close dialog
|
||||
user.getWaiter().until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#close-dialog-btn")));
|
||||
this.waitForBackdropAndClick(user, "#close-dialog-btn");
|
||||
// Best-effort close of the info dialog
|
||||
try {
|
||||
if (!user.getDriver().findElements(By.cssSelector("#close-dialog-btn")).isEmpty()) {
|
||||
this.waitForBackdropAndClick(user, "#close-dialog-btn");
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("Best-effort info-dialog close failed (ignored): {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue