Skip to content

Commit ff75f81

Browse files
author
Alex Hughes
committed
HBASE-29729 Add integration test
1 parent 9d4cb4d commit ff75f81

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.hadoop.hbase.regionserver;
1919

2020
import static org.junit.Assert.assertEquals;
21+
import static org.junit.Assert.assertNotEquals;
2122
import static org.junit.Assert.assertNotNull;
2223
import static org.junit.Assert.assertNull;
2324
import static org.junit.Assert.assertTrue;
@@ -598,4 +599,21 @@ public void testReadBytes() throws Exception {
598599
assertEquals("Total zero-byte read bytes should be equal to 0", 0,
599600
metricsRegionServer.getRegionServerWrapper().getZeroCopyBytesRead());
600601
}
602+
603+
@Test
604+
public void testTableDescriptorHashMetric() throws Exception {
605+
doNPuts(1, false);
606+
metricsRegionServer.getRegionServerWrapper().forceRecompute();
607+
608+
HRegion region = rs.getRegions(tableName).get(0);
609+
assertNotNull("Region should exist", region);
610+
611+
try (MetricsRegionWrapperImpl wrapper = new MetricsRegionWrapperImpl(region)) {
612+
String hash = wrapper.getTableDescriptorHash();
613+
614+
assertNotNull("TableDescriptorHash should not be null", hash);
615+
assertNotEquals("TableDescriptorHash should not be 'UNKNOWN'", "UNKNOWN", hash);
616+
assertEquals("Hash should be 64 characters (SHA-256 hex)", 64, hash.length());
617+
}
618+
}
601619
}

0 commit comments

Comments
 (0)