cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cassandra] dcapwell commented on a change in pull request #446: CASSANDRA-15564 Refactor repair coordinator to centralize stage change logic and improved the public facing errors
Date Tue, 10 Mar 2020 23:59:45 GMT
dcapwell commented on a change in pull request #446: CASSANDRA-15564 Refactor repair coordinator
to centralize stage change logic and improved the public facing errors
URL: https://github.com/apache/cassandra/pull/446#discussion_r390677892
 
 

 ##########
 File path: test/distributed/org/apache/cassandra/distributed/mock/nodetool/InternalNodeProbe.java
 ##########
 @@ -61,7 +79,26 @@ protected void connect()
         mbeanServerConn = null;
         jmxc = null;
 
-        ssProxy = StorageService.instance;
+        if (withNotifications)
+        {
+            ssProxy = StorageService.instance;
+        }
+        else
+        {
+            // replace the notification apis with a no-op method
+            StorageServiceMBean mock = Mockito.spy(StorageService.instance);
+            Mockito.doNothing().when(mock).addNotificationListener(Mockito.any(), Mockito.any(),
Mockito.any());
+            try
+            {
+                Mockito.doNothing().when(mock).removeNotificationListener(Mockito.any(),
Mockito.any(), Mockito.any());
+                Mockito.doNothing().when(mock).removeNotificationListener(Mockito.any());
+            }
+            catch (ListenerNotFoundException e)
+            {
+                throw new AssertionError(e);
+            }
+            ssProxy = mock;
 
 Review comment:
   Very very good question!
   
   This only happens when `withNotifications == false`.  The thing about JMX notifications
are they are lossy.  Given the lossy nature we need the ability to test that we do the right
thing when notifications are not seen on the caller.  So we disable notifications by creating
a "spy" on StorageService and making `removeNotificationListener` do nothing.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message