ui tests: get reliable service url inside containers network

This commit is contained in:
Sergey Matvienko 2023-02-25 15:15:03 +01:00
parent 60973c9422
commit 5edaec55a6
2 changed files with 7 additions and 3 deletions

View File

@ -16,6 +16,7 @@
package org.thingsboard.server.msa;
import lombok.extern.slf4j.Slf4j;
import org.testcontainers.DockerClientFactory;
import java.io.IOException;
import java.io.InputStream;
@ -41,7 +42,9 @@ public class TestProperties {
public static String getBaseUiUrl() {
if (instance.isActive()) {
return "https://host.docker.internal";
//return "https://host.docker.internal" // this alternative requires docker-selenium.yml extra_hosts: - "host.docker.internal:host-gateway"
//return "https://" + DockerClientFactory.instance().dockerHostIpAddress(); //this alternative will get Docker IP from testcontainers
return "https://haproxy"; //communicate inside current docker-compose network to the load balancer container
}
return getProperties().getProperty("tb.baseUiUrl");
}

View File

@ -31,5 +31,6 @@ services:
SE_SCREEN_HEIGHT: 1080
SE_SCREEN_DEPTH: 24
SE_SCREEN_DPI: 74
extra_hosts:
- "host.docker.internal:host-gateway"
# Alternative way how to connect to the host address
# extra_hosts:
# - "host.docker.internal:host-gateway"