This is an automated email from the ASF dual-hosted git repository.

taklwu pushed a commit to branch HBASE-29164
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/HBASE-29164 by this push:
     new 6a4af7f922c HBASE-29815: Fix issue where backup integration tests are 
not running in IntelliJ (#7625)
6a4af7f922c is described below

commit 6a4af7f922cb6939927582bfb217cf1d74207f8d
Author: Kevin Geiszler <[email protected]>
AuthorDate: Thu Jan 15 14:00:40 2026 -0800

    HBASE-29815: Fix issue where backup integration tests are not running in 
IntelliJ (#7625)
    
    Signed-off-by: Tak Lon (Stephen) Wu <[email protected]>
---
 .../hbase/backup/IntegrationTestBackupRestore.java |  3 +-
 .../backup/IntegrationTestBackupRestoreBase.java   | 52 ++++++++++++++++++----
 .../IntegrationTestContinuousBackupRestore.java    |  3 +-
 3 files changed, 45 insertions(+), 13 deletions(-)

diff --git 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestBackupRestore.java
 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestBackupRestore.java
index 99fbcb21a2b..988688eb6f5 100644
--- 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestBackupRestore.java
+++ 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestBackupRestore.java
@@ -45,8 +45,7 @@ public class IntegrationTestBackupRestore extends 
IntegrationTestBackupRestoreBa
   @Override
   @Before
   public void setUp() throws Exception {
-    util = new IntegrationTestingUtility();
-    conf = util.getConfiguration();
+    initializeTestParameters();
     BackupTestUtil.enableBackup(conf);
     LOG.info("Initializing cluster with {} region servers.", 
regionServerCount);
     util.initializeCluster(regionServerCount);
diff --git 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestBackupRestoreBase.java
 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestBackupRestoreBase.java
index 56349fe055a..82464acd40d 100644
--- 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestBackupRestoreBase.java
+++ 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestBackupRestoreBase.java
@@ -38,6 +38,7 @@ import org.apache.hadoop.fs.RemoteIterator;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.HBaseTestingUtil;
 import org.apache.hadoop.hbase.IntegrationTestBase;
+import org.apache.hadoop.hbase.IntegrationTestingUtility;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.backup.impl.BackupAdminImpl;
@@ -90,20 +91,19 @@ public abstract class IntegrationTestBackupRestoreBase 
extends IntegrationTestBa
   protected static final int DEFAULT_NUM_ITERATIONS = 10;
   protected static final int DEFAULT_ROWS_IN_ITERATION = 10000;
   protected static final String SLEEP_TIME_KEY = "sleeptime";
-  // short default interval because tests don't run very long.
+  // Short default interval because tests don't run very long.
   protected static final long SLEEP_TIME_DEFAULT = 50000L;
   protected static String DEFAULT_BACKUP_ROOT_DIR = "backupIT";
 
-  protected static int rowsInIteration;
-  protected static int regionsCountPerServer;
-  protected static int regionServerCount;
-
-  protected static int numIterations;
-  protected static int numTables;
-  protected static TableName[] tableNames;
+  // These test parameters can be configured using a Configuration object or 
via the command line.
+  protected int rowsInIteration;
+  protected int regionsCountPerServer;
+  protected int regionServerCount;
+  protected int numIterations;
+  protected int numTables;
   protected long sleepTime;
-  protected static Object lock = new Object();
 
+  protected static TableName[] tableNames;
   protected FileSystem fs;
   protected String backupRootDir;
 
@@ -715,6 +715,40 @@ public abstract class IntegrationTestBackupRestoreBase 
extends IntegrationTestBa
     return null;
   }
 
+  /**
+   * This method is useful for ensuring important test parameters are 
initialized when running
+   * integration tests in IntelliJ or in the command line with Maven. Tests 
executed in the command
+   * line via the bin/hbase command have their parameters set in
+   * {@link IntegrationTestBase#processOptions}
+   */
+  protected void initializeTestParameters() {
+    util = new IntegrationTestingUtility();
+    conf = util.getConfiguration();
+
+    regionsCountPerServer = conf.getInt(REGION_COUNT_KEY,
+      regionsCountPerServer > 0 ? regionsCountPerServer : 
DEFAULT_REGION_COUNT);
+    LOG.debug("regionsCountPerServer is set to {}", regionsCountPerServer);
+
+    regionServerCount = conf.getInt(REGIONSERVER_COUNT_KEY,
+      regionServerCount > 0 ? regionServerCount : DEFAULT_REGIONSERVER_COUNT);
+    LOG.debug("regionServerCount is set to {}", regionServerCount);
+
+    rowsInIteration = conf.getInt(ROWS_PER_ITERATION_KEY,
+      rowsInIteration > 0 ? rowsInIteration : DEFAULT_ROWS_IN_ITERATION);
+    LOG.debug("rowsInIteration is set to {}", rowsInIteration);
+
+    numIterations =
+      conf.getInt(NUM_ITERATIONS_KEY, numIterations > 0 ? numIterations : 
DEFAULT_NUM_ITERATIONS);
+    LOG.debug("numIterations is set to {}", numIterations);
+
+    numTables =
+      conf.getInt(NUMBER_OF_TABLES_KEY, numTables > 0 ? numTables : 
DEFAULT_NUMBER_OF_TABLES);
+    LOG.debug("numTables is set to {}", numTables);
+
+    sleepTime = conf.getLong(SLEEP_TIME_KEY, sleepTime > 0 ? sleepTime : 
SLEEP_TIME_DEFAULT);
+    LOG.debug("sleepTime is set to {}", sleepTime);
+  }
+
   @Override
   protected void addOptions() {
     addOptWithArg(REGIONSERVER_COUNT_KEY,
diff --git 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestContinuousBackupRestore.java
 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestContinuousBackupRestore.java
index 61ce3eea2b1..8ca8caa04f9 100644
--- 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestContinuousBackupRestore.java
+++ 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestContinuousBackupRestore.java
@@ -54,8 +54,7 @@ public class IntegrationTestContinuousBackupRestore extends 
IntegrationTestBacku
   @Override
   @Before
   public void setUp() throws Exception {
-    util = new IntegrationTestingUtility();
-    conf = util.getConfiguration();
+    initializeTestParameters();
     BackupTestUtil.enableBackup(conf);
     conf.set(CONF_BACKUP_MAX_WAL_SIZE, "10240");
     conf.set(CONF_STAGED_WAL_FLUSH_INITIAL_DELAY, "10");

Reply via email to