Skip to content

Commit

Permalink
Fix unit tests to now use the URI
Browse files Browse the repository at this point in the history
  • Loading branch information
rdettai committed Jun 26, 2024
1 parent c098bac commit cbcbfda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion quickwit/quickwit-cli/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,10 @@ mod tests {
source_type: "file".to_string(),
enabled: "true".to_string(),
}];
let expected_uri = Uri::from_str("path/to/file").unwrap();
let expected_params = vec![ParamsRow {
key: "filepath".to_string(),
value: JsonValue::String("path/to/file".to_string()),
value: JsonValue::String(expected_uri.to_string()),
}];
let expected_checkpoint = vec![
CheckpointRow {
Expand Down
7 changes: 3 additions & 4 deletions quickwit/quickwit-indexing/src/source/file_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ mod tests {
use std::str::FromStr;

use quickwit_actors::{Command, Universe};
use quickwit_common::uri::Uri;
use quickwit_config::{SourceConfig, SourceInputFormat, SourceParams};
use quickwit_metastore::checkpoint::{PartitionId, SourceCheckpointDelta};
use quickwit_proto::types::{IndexUid, Position};
Expand Down Expand Up @@ -236,7 +235,7 @@ mod tests {
let temp_file = generate_dummy_doc_file(gzip, 20_000).await;
let filepath = temp_file.path().to_str().unwrap();
let params = FileSourceParams::from_str(filepath).unwrap();

let uri = params.filepath.as_ref().unwrap().clone();
let source_config = SourceConfig {
source_id: "test-file-source".to_string(),
num_pipelines: NonZeroUsize::new(1).unwrap(),
Expand Down Expand Up @@ -270,7 +269,6 @@ mod tests {
let batch1 = indexer_msgs[0].downcast_ref::<RawDocBatch>().unwrap();
let batch2 = indexer_msgs[1].downcast_ref::<RawDocBatch>().unwrap();
let command = indexer_msgs[2].downcast_ref::<Command>().unwrap();
let uri = Uri::from_str(filepath).unwrap();
assert_eq!(
format!("{:?}", &batch1.checkpoint_delta),
format!(
Expand Down Expand Up @@ -309,6 +307,7 @@ mod tests {
let temp_file = generate_index_doc_file(gzip, 100).await;
let temp_file_path = temp_file.path().to_str().unwrap();
let params = FileSourceParams::from_str(temp_file_path).unwrap();
let uri = params.filepath.as_ref().unwrap();
let source_config = SourceConfig {
source_id: "test-file-source".to_string(),
num_pipelines: NonZeroUsize::new(1).unwrap(),
Expand All @@ -317,7 +316,7 @@ mod tests {
transform_config: None,
input_format: SourceInputFormat::Json,
};
let partition_id = PartitionId::from(temp_file_path);
let partition_id = PartitionId::from(uri.as_str());
let source_checkpoint_delta = SourceCheckpointDelta::from_partition_delta(
partition_id,
Position::Beginning,
Expand Down

0 comments on commit cbcbfda

Please sign in to comment.