This is an automated email from the ASF dual-hosted git repository.
apurtell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new 6d9ec471da PHOENIX-7980 Improve handling of test timeouts and resource
loss (#2593)
6d9ec471da is described below
commit 6d9ec471dae52ef39020bcafdeffecebbedd142d
Author: Andrew Purtell <[email protected]>
AuthorDate: Tue Aug 4 17:23:46 2026 -0700
PHOENIX-7980 Improve handling of test timeouts and resource loss (#2593)
---
.../java/org/apache/phoenix/query/BaseTest.java | 23 ++++++++++++++++++++++
pom.xml | 3 +++
2 files changed, 26 insertions(+)
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index e2e3afedef..41208464f6 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -169,6 +169,7 @@ import org.apache.phoenix.util.ServerUtil.ConnectionFactory;
import org.apache.phoenix.util.TestUtil;
import org.junit.ClassRule;
import org.junit.rules.TemporaryFolder;
+import org.junit.rules.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -198,6 +199,9 @@ public abstract class BaseTest {
private static final Logger LOGGER = LoggerFactory.getLogger(BaseTest.class);
@ClassRule
public static TemporaryFolder tmpFolder = new TemporaryFolder();
+ @ClassRule
+ public static Timeout CLASS_TIMEOUT =
+ Timeout.builder().withTimeout(20,
TimeUnit.MINUTES).withLookingForStuckThread(true).build();
private static final int dropTableTimeout = 120; // 2 mins should be long
enough.
private static final ThreadFactory factory = new
ThreadFactoryBuilder().setDaemon(true)
.setNameFormat("DROP-TABLE-BASETEST" + "-thread-%s").build();
@@ -446,12 +450,31 @@ public abstract class BaseTest {
protected static synchronized void setUpTestDriver(ReadOnlyProps serverProps,
ReadOnlyProps clientProps) throws Exception {
+ assertSharedMiniClusterHealthy();
if (driver == null) {
String url = checkClusterInitialized(serverProps);
driver = initAndRegisterTestDriver(url, clientProps);
}
}
+ private static void assertSharedMiniClusterHealthy() {
+ if (
+ !clusterInitialized || utility == null
+ || isDistributedClusterModeEnabled(utility.getConfiguration())
+ ) {
+ return;
+ }
+ MiniHBaseCluster cluster = utility.getHBaseCluster();
+ HMaster master = cluster == null ? null : cluster.getMaster();
+ if (
+ master == null || !master.isActiveMaster() || !master.isInitialized() ||
master.isAborted()
+ || master.isStopped()
+ ) {
+ throw new IllegalStateException("Shared in-JVM minicluster is unhealthy
(master not up); "
+ + "failing fast so subsequent tests on this fork do not hang.");
+ }
+ }
+
private static boolean isDistributedClusterModeEnabled(Configuration conf) {
boolean isDistributedCluster = false;
// check if the distributed mode was specified as a system property.
diff --git a/pom.xml b/pom.xml
index 0e234bea71..58f24340a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1647,6 +1647,7 @@
</goals>
<configuration>
<reuseForks>false</reuseForks>
+
<forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
<skip>${skipNeedsOwnMiniClusterTests}</skip>
<groups>org.apache.phoenix.end2end.NeedsOwnMiniClusterTest</groups>
</configuration>
@@ -1877,6 +1878,8 @@
<forkCount>${numForkedUT}</forkCount>
<reuseForks>true</reuseForks>
<redirectTestOutputToFile>${test.output.tofile}</redirectTestOutputToFile>
+ <forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
+
<forkedProcessExitTimeoutInSeconds>180</forkedProcessExitTimeoutInSeconds>
<shutdown>exit</shutdown>
<trimStackTrace>false</trimStackTrace>
<forkNode
implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>