public Node getLeader(String clusterName) {
        Map<String/*raft-group*/, Node> map = leaders.computeIfAbsent(clusterName, k -> new ConcurrentHashMap<>());
        List<Node> nodes = new ArrayList<>(map.values());
        return nodes.size() > 0 ? nodes.get(ThreadLocalRandom.current().nextInt(nodes.size())) : null;
    }
@Test
    public void testGetLeader() {
        Assertions.assertNull(metadata.getLeader("leader"));

        Node node = new Node();
        node.setGroup("group");
        metadata.setLeaderNode("leader", node);
        Assertions.assertNotNull(metadata.getLeader("leader"));
    }