ZookeeperLeaderFinder { protected String host(Pod pod) { String cluster = Labels.cluster(pod); String podName = pod.getMetadata().getName(); int index = podName.lastIndexOf('-'); if (index == -1 || index >= podName.length()) { throw new RuntimeException(); } int podId = parseInt(podName.substring(index + 1)); return ZookeeperCluster.podDnsName(pod.getMetadata().getNamespace(), cluster, podId); } ZookeeperLeaderFinder(Vertx vertx, SecretOperator secretOperator, Supplier<BackOff> backOffSupplier);  static final int UNKNOWN_LEADER; }
@Test public void testGetHostReturnsCorrectHostForGivenPod() { Pod pod = new PodBuilder() .withNewMetadata() .withName(ZookeeperCluster.zookeeperPodName("my-cluster", 3)) .withNamespace("myproject") .addToLabels(Labels.STRIMZI_CLUSTER_LABEL, "my-cluster") .endMetadata() .build(); assertThat(new ZookeeperLeaderFinder(vertx, null, this::backoff).host(pod), is("my-cluster-zookeeper-3.my-cluster-zookeeper-nodes.myproject.svc.cluster.local")); }