smiklosovic commented on code in PR #3716:
URL: https://github.com/apache/cassandra/pull/3716#discussion_r2228053247


##########
test/distributed/org/apache/cassandra/distributed/test/ring/BootstrapTest.java:
##########
@@ -288,4 +296,80 @@ public static void markViewsAsBuilt(@SuperCall 
Callable<Void> zuper)
         }
     }
 
+    /**
+     * This regression test for CASSANDRA-19902 ensures {@link 
StorageServiceMBean} JMX
+     * interface is published before the node finishes bootstrapping
+     */
+    @Test
+    public void testStorageServiceMBeanIsPublishedOnJMXDuringBootstrap() 
throws Throwable
+    {
+        ExecutorService es = Executors.newFixedThreadPool(1);
+        try (Cluster cluster = builder().withNodes(2)
+                                        .withConfig(config -> 
config.with(GOSSIP)
+                                                                    
.with(NETWORK)
+                                                                    .with(JMX)
+                                                                    
.set("auto_bootstrap", true))
+                                        
.withInstanceInitializer(BBBootstrapInterceptor::install)
+                                        .createWithoutStarting();
+             Closeable ignored = es::shutdown)
+        {
+            Runnable test = () ->
+            {
+                // Wait for bootstrap to start via countdown latch
+                IInvokableInstance joiningInstance = cluster.get(2);
+                joiningInstance.runOnInstance(() -> 
BBBootstrapInterceptor.bootstrapStart.awaitUninterruptibly());
+                // At this point, it should be possible to check bootstrap 
status via JMX.
+                IInstanceConfig config = joiningInstance.config();
+                try (JMXConnector jmxc = JMXUtil.getJmxConnector(config))
+                {
+                    MBeanServerConnection mbsc = 
jmxc.getMBeanServerConnection();
+                    StorageServiceMBean sp = 
javax.management.JMX.newMBeanProxy(mbsc, new 
ObjectName("org.apache.cassandra.db:type=StorageService"), 
StorageServiceMBean.class);
+                    assertEquals(sp.getOperationMode(), 
StorageService.Mode.JOINING.toString());

Review Comment:
   returns STARTING 



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to