GreptimeTeam/greptimedb

the `region_stats` API will return an error in instance test

Closed this issue · 1 comments

          @WenyXu  Looks like the `region_stats` API will return an error in instance test 

async fn test_use_database(instance: Arc<dyn MockInstance>) {

The failure CI is https://github.com/GreptimeTeam/greptimedb/actions/runs/11657280986/job/32454614252?pr=4927

thread 'tests::instance_test::test_use_database::case_2_test_with_distributed' panicked at /Users/dennis/programming/rust/greptimedb/src/common/test-util/src/recordbatch.rs:26:75:
called `Result::unwrap()` on an `Err` value: 0: , at src/common/recordbatch/src/adapter.rs:291:55
1: External(External(0: , at src/common/recordbatch/src/adapter.rs:291:55
1: External(0: Failed to region stats in cluster, at src/cmd/src/lib.rs:172:14

So I have to use unwrap_or_else instead of ? operator here.

Originally posted by @killme2008 in #4927 (comment)

We can call enable_access_cluster_info in tests-integration/cluster's build_frontend method to fix it

    async fn build_frontend(
        &self,
        metasrv: MockInfo,
        datanode_clients: Arc<NodeClients>,
    ) -> Arc<FeInstance> {
        let mut meta_client = MetaClientBuilder::frontend_default_options(1000)
            .channel_manager(metasrv.channel_manager)
            .enable_access_cluster_info()
            .build();