pivotal-eshu commented on code in PR #7630: URL: https://github.com/apache/geode/pull/7630#discussion_r860216096
########## geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java: ########## @@ -317,4 +331,38 @@ public void testGetAllHostingMembersReturnsMemberWhenBucketAdvisorHasTwoProfiles assertThat(bucketAdvisor.adviseInitialized().size()).isEqualTo(1); } + + @Test + void removePrimaryDeposePrimaryForColocatedChildrenBeforeReleasePrimaryLock() { + when(regionAdvisor.getPartitionedRegion()).thenReturn(partitionedRegion); + when(regionAdvisor.getBucket(any(Integer.class))).thenReturn(bucket); + when(partitionedRegion.getPartitionAttributes()).thenReturn(new PartitionAttributesImpl()); + when(bucket.getDistributionManager()).thenReturn(mock(DistributionManager.class)); + BucketAdvisor bucketAdvisor = spy(BucketAdvisor.createBucketAdvisor(bucket, regionAdvisor)); + InternalDistributedMember member = mock(InternalDistributedMember.class); + DistributionManager manager = mock(DistributionManager.class); + doReturn(true).when(bucketAdvisor).isPrimary(); + doReturn(manager).when(bucketAdvisor).getDistributionManager(); + when(manager.getId()).thenReturn(member); + bucketAdvisor.setPrimaryMemberForTest(member); Review Comment: No longer add this method, but use an existing one instead. Change the method to be synchronized one should not be an issue as the "Caller must be synced on this". -- 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