KubeClusterMembershipConnector implements ClusterMembershipConnector { @Override public Optional<ClusterMembershipRevision<ClusterMemberLeadership>> findCurrentLeader() { return reconciler.getCurrent().findCurrentLeader(); } KubeClusterMembershipConnector(ClusterMember initial,
                                          KubeMembershipExecutor kubeMembershipExecutor,
                                          KubeLeaderElectionExecutor kubeLeaderElectionExecutor,
                                          KubeClusterMembershipConfiguration configuration,
                                          TitusRuntime titusRuntime); @PreDestroy void shutdown(); @Override ClusterMembershipRevision<ClusterMember> getLocalClusterMemberRevision(); @Override Map<String, ClusterMembershipRevision<ClusterMember>> getClusterMemberSiblings(); @Override ClusterMembershipRevision<ClusterMemberLeadership> getLocalLeadershipRevision(); @Override Optional<ClusterMembershipRevision<ClusterMemberLeadership>> findCurrentLeader(); @Override Mono<ClusterMembershipRevision<ClusterMember>> register(Function<ClusterMember, ClusterMembershipRevision<ClusterMember>> selfUpdate); @Override Mono<ClusterMembershipRevision<ClusterMember>> unregister(Function<ClusterMember, ClusterMembershipRevision<ClusterMember>> selfUpdate); @Override Mono<Void> joinLeadershipGroup(); @Override Mono<Boolean> leaveLeadershipGroup(boolean onlyNonLeader); @Override Flux<ClusterMembershipEvent> membershipChangeEvents();  }
@Test public void testDiscoveryOfSiblingLeader() throws InterruptedException { ClusterMemberLeadership sibling = electSiblingAsLeader(); ClusterMembershipRevision<ClusterMemberLeadership> leader = connector.findCurrentLeader().orElseThrow(() -> new IllegalStateException("Leader not found")); assertThat(leader.getCurrent()).isEqualTo(sibling); }