mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-20 06:50:37 +00:00
* test: use EtcdStore in IT cases Signed-off-by: tison <wander4096@gmail.com> * retrigger CI Signed-off-by: tison <wander4096@gmail.com> * refactor: KvPair can take etcd KeyValue Signed-off-by: tison <wander4096@gmail.com> * temporary use fork Signed-off-by: tison <wander4096@gmail.com> * drop cloned Signed-off-by: tison <wander4096@gmail.com> * chroot_key_value Signed-off-by: tison <wander4096@gmail.com> * chroot and prepend in each point Signed-off-by: tison <wander4096@gmail.com> * adjust call points Signed-off-by: tison <wander4096@gmail.com> * cargo clippy Signed-off-by: tison <wander4096@gmail.com> * point to upstream etcd-client Signed-off-by: tison <wander4096@gmail.com> * test etcd chroot Signed-off-by: tison <wander4096@gmail.com> * add NO_CHROOT constant Signed-off-by: tison <wander4096@gmail.com> * check Signed-off-by: tison <wander4096@gmail.com> * handle range end Signed-off-by: tison <wander4096@gmail.com> * handle special encoded key or range_end Signed-off-by: tison <wander4096@gmail.com> * fixup implementation Signed-off-by: tison <wander4096@gmail.com> * clippy Signed-off-by: tison <wander4096@gmail.com> * avoid test name conflict Signed-off-by: tison <wander4096@gmail.com> * chroot to kvbackend level Signed-off-by: tison <wander4096@gmail.com> * fixup all occurances Signed-off-by: tison <wander4096@gmail.com> * fix type Signed-off-by: tison <wander4096@gmail.com> * Update src/common/meta/src/kv_backend/txn.rs * make github happy --------- Signed-off-by: tison <wander4096@gmail.com> Co-authored-by: LFC <990479+MichaelScofield@users.noreply.github.com>
49 lines
1.5 KiB
Rust
49 lines
1.5 KiB
Rust
// Copyright 2023 Greptime Team
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
mod instance_test;
|
|
mod promql_test;
|
|
mod test_util;
|
|
|
|
use std::collections::HashMap;
|
|
use std::sync::Arc;
|
|
|
|
use common_meta::key::TableMetadataManagerRef;
|
|
use datanode::datanode::Datanode;
|
|
use frontend::instance::Instance;
|
|
|
|
use crate::cluster::{GreptimeDbCluster, GreptimeDbClusterBuilder};
|
|
|
|
pub struct MockDistributedInstance(GreptimeDbCluster);
|
|
|
|
impl MockDistributedInstance {
|
|
pub fn frontend(&self) -> Arc<Instance> {
|
|
self.0.frontend.clone()
|
|
}
|
|
|
|
pub fn datanodes(&self) -> &HashMap<u64, Datanode> {
|
|
&self.0.datanode_instances
|
|
}
|
|
|
|
pub fn table_metadata_manager(&self) -> &TableMetadataManagerRef {
|
|
self.0.meta_srv.table_metadata_manager()
|
|
}
|
|
}
|
|
|
|
pub async fn create_distributed_instance(test_name: &str) -> MockDistributedInstance {
|
|
let builder = GreptimeDbClusterBuilder::new(test_name).await;
|
|
let cluster = builder.build().await;
|
|
MockDistributedInstance(cluster)
|
|
}
|