sharmaar12 commented on code in PR #7923:
URL: https://github.com/apache/hbase/pull/7923#discussion_r2932198314


##########
hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java:
##########
@@ -164,4 +165,27 @@ private TableName validateNames(TableName expected, Names 
names) {
     assertArrayEquals(expected.getNamespace(), names.nsb);
     return expected;
   }
+
+  @Test
+  public void testValidMetaTableSuffix() {
+    String[] validSuffixes = { "REPL1", "123", "123abc" };
+    for (String suffix : validSuffixes) {
+      Configuration conf = HBaseConfiguration.create();
+      conf.set(HConstants.HBASE_META_TABLE_SUFFIX, suffix);
+      TableName metaTableName = TableName.initializeHbaseMetaTableName(conf);
+      assertEquals("hbase:meta_" + suffix, metaTableName.getNameAsString());
+    }
+  }
+
+  @Test
+  public void testInvalidMetaTableSuffix() {
+    String[] invalidSuffixes = { "test_1", "test-1", "test.1", "test 1", 
"_test",
+      "-test", ".test", "has!special", " " };

Review Comment:
   This is just for readability that two colon should not be present in the 
Active Cluster Suffix ID file.
   reference: https://github.com/apache/hbase/pull/7857#discussion_r2924710242



##########
hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java:
##########
@@ -164,4 +165,27 @@ private TableName validateNames(TableName expected, Names 
names) {
     assertArrayEquals(expected.getNamespace(), names.nsb);
     return expected;
   }
+
+  @Test
+  public void testValidMetaTableSuffix() {
+    String[] validSuffixes = { "REPL1", "123", "123abc" };
+    for (String suffix : validSuffixes) {
+      Configuration conf = HBaseConfiguration.create();
+      conf.set(HConstants.HBASE_META_TABLE_SUFFIX, suffix);
+      TableName metaTableName = TableName.initializeHbaseMetaTableName(conf);
+      assertEquals("hbase:meta_" + suffix, metaTableName.getNameAsString());
+    }
+  }
+
+  @Test
+  public void testInvalidMetaTableSuffix() {
+    String[] invalidSuffixes = { "test_1", "test-1", "test.1", "test 1", 
"_test",
+      "-test", ".test", "has!special", " " };

Review Comment:
   ```suggestion
         "-test", ".test", "has!special", "has:colon"," " };
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to