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