DonalEvans commented on a change in pull request #7410:
URL: https://github.com/apache/geode/pull/7410#discussion_r817181913
##########
File path:
geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTest.java
##########
@@ -637,6 +645,85 @@ public void testNotifyRegionCreated() {
assertThat(partitionedRegion.isRegionCreateNotified()).isTrue();
}
+ @Test
+ public void
populateEmptyIndexesThrowsIfBucketRegionDestroyedDueToCacheClose() {
+ PartitionedRegion spyPartitionedRegion = spy(partitionedRegion);
+ BucketRegion bucketRegion = mock(BucketRegion.class);
+ when(bucketRegion.isDestroyed()).thenReturn(true);
+
+ Set<Index> indexes = setupIndexes();
+ ConcurrentMap<Integer, BucketRegion> map = setupBuckets(bucketRegion);
+ setupDataStore(spyPartitionedRegion, map);
+ CacheClosedException cacheClosedException = new CacheClosedException();
+ setupCancelCriterion(cacheClosedException);
+
+ assertThatThrownBy(() ->
spyPartitionedRegion.populateEmptyIndexes(indexes, new HashMap<>()))
+ .isInstanceOf(CancelException.class).isEqualTo(cacheClosedException);
Review comment:
I think that it's redundant to have both
`.isInstanceOf(CancelException.class)` and `.isEqualTo(cacheClosedException)`,
since it's not possible that the exception is equal to `cacheClosedException`
but NOT an instance of `CancelException`. It should be enough to just have the
`isEqualTo()` check.
--
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: notifications-unsubscr...@geode.apache.org
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org