Copilot commented on code in PR #8392:
URL: https://github.com/apache/hbase/pull/8392#discussion_r3450459399
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestDefaultMobStoreCompactor.java:
##########
@@ -49,6 +55,25 @@ public void testCacheMobBlocksOnCompactionCanBeDisabled() {
assertFalse(compactor.cacheMobBlocksOnCompaction);
}
+ @Test
+ public void testResolveMobCellClosesMobCellAndReturnsIndependentCopy()
throws Exception {
+ Configuration conf = new Configuration();
+ DefaultMobStoreCompactor compactor = newCompactor(conf);
+ ExtendedCell reference = new KeyValue(Bytes.toBytes("row"),
Bytes.toBytes("family"),
+ Bytes.toBytes("qualifier"), Bytes.toBytes("mob-reference"));
+ ExtendedCell resolved = new KeyValue(Bytes.toBytes("row"),
Bytes.toBytes("family"),
+ Bytes.toBytes("qualifier"), Bytes.toBytes("mob-value"));
+ MobCell mobCell = mock(MobCell.class);
+ when(mobCell.getCell()).thenReturn(resolved);
+ when(compactor.mobStore.resolve(reference, true,
false)).thenReturn(mobCell);
Review Comment:
This stub hard-codes the `cacheMobBlocksOnCompaction` argument to `true`,
making the test brittle if the default config or the compactor initialization
changes. Prefer stubbing with the compactor’s actual field value (e.g.,
`compactor.cacheMobBlocksOnCompaction`) or using argument matchers for the
boolean(s) so the test verifies close/copy behavior without depending on a
specific default.
--
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]