@Test
  public void testHRegionServerExitingMainLoop() {
    final Matcher<SpanData> rsExitingMainLoopMatcher =
      allOf(hasName("HRegionServer exiting main loop"), hasParentSpanId(NO_PARENT_ID),
        hasStatusWithCode(isOneOf(StatusCode.OK, StatusCode.ERROR)));
    assertThat("there should be a span from the HRegionServer exiting main loop.", spans,
      hasItem(rsExitingMainLoopMatcher));
    final SpanData rsExitingMainLoopSpan = spans.stream().filter(rsExitingMainLoopMatcher::matches)
      .findAny().orElseThrow(AssertionError::new);
    assertThat("the HRegionServer exiting main loop span should show zookeeper interaction.", spans,
      hasItem(allOf(hasName(startsWith("RecoverableZookeeper.")),
        hasParentSpanId(rsExitingMainLoopSpan))));
    assertThat("the HRegionServer exiting main loop span should show AsyncConnection interaction.",
      spans, hasItem(
        allOf(hasName(startsWith("AsyncConnection.")), hasParentSpanId(rsExitingMainLoopSpan))));
    assertThat("the HRegionServer exiting main loop span should invoke CloseMetaHandler.", spans,
      hasItem(allOf(hasName("CloseMetaHandler"), hasParentSpanId(rsExitingMainLoopSpan))));
  }
Wait for the underlying cluster to come up -- defined by meta being available.
hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerInternalsTracing.java