protected Optional<BrokerData> findOneBroker(String topic) throws Exception {
        try {
            List<BrokerData> brokerDatas = topicRouteService.getAllMessageQueueView(ProxyContext.createForInner(this.getClass()), topic).getTopicRouteData().getBrokerDatas();
            int skipNum = random.nextInt(brokerDatas.size());
            return brokerDatas.stream().skip(skipNum).findFirst();
        } catch (Exception e) {
            if (TopicRouteHelper.isTopicNotExistError(e)) {
                return Optional.empty();
            }
            throw e;
        }
    }
@Test
    public void findOneBroker() {

        Set<String> resultBrokerNames = new HashSet<>();
        // run 1000 times to test the random
        for (int i = 0; i < 1000; i++) {
            Optional<BrokerData> brokerData = null;
            try {
                brokerData = this.clusterMetadataService.findOneBroker(TOPIC);
                resultBrokerNames.add(brokerData.get().getBrokerName());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
        // we should choose two brokers
        assertEquals(2, resultBrokerNames.size());
    }