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