Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#2539] Improvement: Use environment variable to control showing or hiding web page in test (#2555)

Ziva Li7ea8222a0d33
diff --git a/docs/how-to-test.md b/docs/how-to-test.md
index fd5d517b23..affbcff816 100644
--- a/docs/how-to-test.md
+++ b/docs/how-to-test.md
@@ -74,6 +74,13 @@ To deploy the Gravitino server locally to run the integration tests, follow thes
* Skip web frontend integration tests by using the `./gradlew build -PskipWebITs` command.
* Skip both unit tests and integration tests by using the `./gradlew build -x test` or `./gradlew build -PskipTests -PskipITs` commands.
+## Configuring parameters for integration tests
+### `DISPLAY_WEBPAGE_IN_TESTING`
+By default, the Gravitino web frontend page will not pop up when running integration tests.
+If you wish to display the web frontend page during integrations test, you can set the `DISPLAY_WEBPAGE_IN_TESTING` environment variable in `setIntegrationTestEnvironment` in file build.gradle.kts.
+For example:
+```param.environment("DISPLAY_WEBPAGE_IN_TESTING", true)```
+
## Docker test environment
Some integration test cases depend on the Gravitino CI Docker image.
diff --git a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/utils/ChromeWebDriverProvider.java b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/utils/ChromeWebDriverProvider.java
index a39a98fc1e..dbbd588ba0 100644
--- a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/utils/ChromeWebDriverProvider.java
+++ b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/utils/ChromeWebDriverProvider.java
@@ -11,6 +11,7 @@ import java.net.URL;
import java.time.Instant;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.SystemUtils;
+import org.apache.logging.log4j.util.Strings;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
@@ -86,12 +87,17 @@ public class ChromeWebDriverProvider implements WebDriverProvider {
System.setProperty(
"webdriver.chrome.driver", ITUtils.joinPath(downLoadDir, chromeDriverBinName));
ChromeOptions chromeOptions = new ChromeOptions();
+
+ // Display the web interface during testing
+ if (Strings.isEmpty(System.getenv("DISPLAY_WEBPAGE_IN_TESTING"))) {
+ chromeOptions.addArguments("--headless");
+ }
+
if (SystemUtils.IS_OS_MAC_OSX) {
chromeOptions.setBinary(
ITUtils.joinPath(downLoadDir, chromeBinName, "Contents", "MacOS", "Chromium"));
} else {
chromeOptions.setBinary(ITUtils.joinPath(downLoadDir, chromeBinName));
- chromeOptions.addArguments("--headless");
}
return new ChromeDriver(chromeOptions);