Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update toolchain to nightly-2024-04-18 #3740

Merged
merged 9 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix test clippy
Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia committed Apr 18, 2024
commit b32cb9077d80fb84294fdfb9b4fffa63e7ad8762
6 changes: 3 additions & 3 deletions src/auth/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ impl Default for MockUserProvider {

impl MockUserProvider {
pub fn set_authorization_info(&mut self, info: DatabaseAuthInfo) {
self.catalog = info.catalog.to_owned();
self.schema = info.schema.to_owned();
self.username = info.username.to_owned();
info.catalog.clone_into(&mut self.catalog);
info.schema.clone_into(&mut self.schema);
info.username.clone_into(&mut self.username);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/meta/src/wal_options_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ mod tests {
let kv_backend = Arc::new(MemoryKvBackend::new()) as KvBackendRef;
let mut topic_manager = KafkaTopicManager::new(config.clone(), kv_backend);
// Replaces the default topic pool with the constructed topics.
topic_manager.topic_pool = topics.clone();
topic_manager.topic_pool.clone_from(&topics);
// Replaces the default selector with a round-robin selector without shuffled.
topic_manager.topic_selector = Arc::new(RoundRobinTopicSelector::default());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ mod tests {
let kv_backend = Arc::new(MemoryKvBackend::new()) as KvBackendRef;
let mut manager = TopicManager::new(config.clone(), kv_backend);
// Replaces the default topic pool with the constructed topics.
manager.topic_pool = topics.clone();
manager.topic_pool.clone_from(&topics);
// Replaces the default selector with a round-robin selector without shuffled.
manager.topic_selector = Arc::new(RoundRobinTopicSelector::default());
manager.start().await.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/common/time/src/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ mod tests {
let (sec, nsec) = Timestamp::new(i64::MIN, TimeUnit::Nanosecond).split();
let time = DateTime::from_timestamp(sec, nsec).unwrap().naive_utc();
assert_eq!(sec, time.and_utc().timestamp());
assert_eq!(nsec, time.timestamp_subsec_nanos());
assert_eq!(nsec, time.and_utc().timestamp_subsec_nanos());
}

#[test]
Expand Down
33 changes: 0 additions & 33 deletions src/meta-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,6 @@ impl MetaClient {
#[cfg(test)]
mod tests {
use api::v1::meta::{HeartbeatRequest, Peer};
use meta_srv::metasrv::SelectorContext;
use meta_srv::selector::{Namespace, Selector, SelectorOptions};
use meta_srv::Result as MetaResult;

use super::*;
use crate::{error, mocks};
Expand Down Expand Up @@ -662,36 +659,6 @@ mod tests {
});
}

struct MockSelector;

#[async_trait::async_trait]
impl Selector for MockSelector {
type Context = SelectorContext;
type Output = Vec<Peer>;

async fn select(
&self,
_ns: Namespace,
_ctx: &Self::Context,
_opts: SelectorOptions,
) -> MetaResult<Self::Output> {
Ok(vec![
Peer {
id: 0,
addr: "peer0".to_string(),
},
Peer {
id: 1,
addr: "peer1".to_string(),
},
Peer {
id: 2,
addr: "peer2".to_string(),
},
])
}
}

#[tokio::test]
async fn test_range_get() {
let tc = new_client("test_range_get").await;
Expand Down
10 changes: 4 additions & 6 deletions src/meta-srv/src/selector/load_based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,9 @@ mod tests {
let alive_stat_kvs = filter_out_expired_datanode(stat_kvs, &lease_kvs);

assert_eq!(1, alive_stat_kvs.len());
assert!(alive_stat_kvs
.get(&StatKey {
cluster_id: 1,
node_id: 1
})
.is_some());
assert!(alive_stat_kvs.contains_key(&StatKey {
cluster_id: 1,
node_id: 1
}));
}
}
8 changes: 4 additions & 4 deletions src/metric-engine/src/engine/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,12 @@ mod test {

let mut options = HashMap::new();
options.insert(PHYSICAL_TABLE_METADATA_KEY.to_string(), "value".to_string());
request.options = options.clone();
request.options.clone_from(&options);
let result = MetricEngineInner::verify_region_create_request(&request);
assert!(result.is_ok());

options.insert(LOGICAL_TABLE_METADATA_KEY.to_string(), "value".to_string());
request.options = options.clone();
request.options.clone_from(&options);
let result = MetricEngineInner::verify_region_create_request(&request);
assert!(result.is_err());

Expand Down Expand Up @@ -620,14 +620,14 @@ mod test {
data_region_request.primary_key,
vec![ReservedColumnId::table_id(), ReservedColumnId::tsid(), 1]
);
assert!(data_region_request.options.get("ttl").is_some());
assert!(data_region_request.options.contains_key("ttl"));

// check create metadata region request
let metadata_region_request = engine_inner.create_request_for_metadata_region(&request);
assert_eq!(
metadata_region_request.region_dir,
"/test_dir/metadata/".to_string()
);
assert!(metadata_region_request.options.get("ttl").is_none());
assert!(!metadata_region_request.options.contains_key("ttl"));
}
}
2 changes: 1 addition & 1 deletion src/mito2/src/region/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ mod tests {
// No need to add compatible tests for RegionOptions since the above tests already check for compatibility.
#[test]
fn test_with_any_wal_options() {
let all_wal_options = vec![
let all_wal_options = [
WalOptions::RaftEngine,
WalOptions::Kafka(KafkaWalOptions {
topic: "test_topic".to_string(),
Expand Down
8 changes: 4 additions & 4 deletions src/mito2/src/sst/parquet/row_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ mod tests {

#[test]
fn test_non_contiguous_ranges() {
let ranges = vec![1..3, 5..8];
let ranges = [1..3, 5..8];
let (selection, skipped) = row_selection_from_row_ranges(ranges.iter().cloned(), 10);
let expected = RowSelection::from(vec![
RowSelector::skip(1),
Expand All @@ -96,7 +96,7 @@ mod tests {

#[test]
fn test_empty_range() {
let ranges = vec![];
let ranges = [];
let (selection, skipped) = row_selection_from_row_ranges(ranges.iter().cloned(), 10);
let expected = RowSelection::from(vec![]);
assert_eq!(selection, expected);
Expand All @@ -105,7 +105,7 @@ mod tests {

#[test]
fn test_adjacent_ranges() {
let ranges = vec![1..2, 2..3];
let ranges = [1..2, 2..3];
let (selection, skipped) = row_selection_from_row_ranges(ranges.iter().cloned(), 10);
let expected = RowSelection::from(vec![RowSelector::skip(1), RowSelector::select(2)]);
assert_eq!(selection, expected);
Expand All @@ -114,7 +114,7 @@ mod tests {

#[test]
fn test_large_gap_between_ranges() {
let ranges = vec![1..2, 100..101];
let ranges = [1..2, 100..101];
let (selection, skipped) = row_selection_from_row_ranges(ranges.iter().cloned(), 10240);
let expected = RowSelection::from(vec![
RowSelector::skip(1),
Expand Down
2 changes: 1 addition & 1 deletion src/query/src/tests/time_range_filter_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct DataSourceWrapper {

impl DataSource for DataSourceWrapper {
fn get_stream(&self, request: ScanRequest) -> Result<SendableRecordBatchStream, BoxedError> {
*self.filter.write().unwrap() = request.filters.clone();
self.filter.write().unwrap().clone_from(&request.filters);
waynexia marked this conversation as resolved.
Show resolved Hide resolved
self.inner.get_stream(request)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/table/src/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ mod tests {

let file = std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
tisonkun marked this conversation as resolved.
Show resolved Hide resolved
.open(path.clone())
.unwrap();

Expand Down