Skip to content

Commit

Permalink
refactor: PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldix committed Jan 6, 2025
1 parent 068d0d8 commit 80c33ab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
8 changes: 0 additions & 8 deletions influxdb3/src/commands/plugin_test/wal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ pub struct WalPluginTest {
/// If given, pass this file of LP as input from on the server `<plugin-dir>/<name>_test/<input-file>`
#[clap(long = "file")]
pub input_file: Option<String>,
/// If given, save the output to this file on the server in `<plugin-dir>/<name>_test/<save-output-to-file>`
#[clap(long = "save-output-to-file")]
pub save_output_to_file: Option<String>,
/// If given, validate the output against this file on the server in `<plugin-dir>/<name>_test/<validate-output-file>`
#[clap(long = "validate-output-file")]
pub validate_output_file: Option<String>,
/// If given pass this map of string key/value pairs as input arguments
#[clap(long = "input-arguments")]
pub input_arguments: Option<SeparatedList<SeparatedKeyValue<String, String>>>,
Expand All @@ -47,8 +41,6 @@ impl From<WalPluginTest> for WalPluginTestRequest {
name: val.name,
input_lp: val.input_lp,
input_file: val.input_file,
save_output_to_file: val.save_output_to_file,
validate_output_file: val.validate_output_file,
input_arguments,
}
}
Expand Down
2 changes: 0 additions & 2 deletions influxdb3_client/src/plugin_development.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ pub struct WalPluginTestRequest {
pub name: String,
pub input_lp: Option<String>,
pub input_file: Option<String>,
pub save_output_to_file: Option<String>,
pub validate_output_file: Option<String>,
pub input_arguments: Option<HashMap<String, String>>,
}

Expand Down
16 changes: 7 additions & 9 deletions influxdb3_write/src/write_buffer/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ pub(crate) fn run_test_wal_plugin(
use data_types::NamespaceName;
use influxdb3_wal::Gen1Duration;

const TEST_NAMESPACE: &str ="_testdb";

let namespace = NamespaceName::new(TEST_NAMESPACE).unwrap();
// parse the lp into a write batch
let namespace = NamespaceName::new("_testdb").unwrap();
let validator = WriteValidator::initialize(
namespace.clone(),
Arc::clone(&catalog),
Expand Down Expand Up @@ -394,15 +396,13 @@ def process_writes(influxdb3_local, table_batches, args=None):
name: "test".into(),
input_lp: Some(lp),
input_file: None,
save_output_to_file: None,
validate_output_file: None,
input_arguments: Some(HashMap::from([(
String::from("arg1"),
String::from("val1"),
)])),
};

let reesponse =
let response =
run_test_wal_plugin(now, Arc::new(catalog), code.to_string(), request).unwrap();

let expected_log_lines = vec![
Expand All @@ -412,20 +412,20 @@ def process_writes(influxdb3_local, table_batches, args=None):
"INFO: table: mem", "INFO: row: {'time': 120, 'fields': [{'name': 'host', 'value': 'B'}, {'name': 'user', 'value': 43.1}]}",
"INFO: done",
].into_iter().map(|s| s.to_string()).collect::<Vec<_>>();
assert_eq!(reesponse.log_lines, expected_log_lines);
assert_eq!(response.log_lines, expected_log_lines);

let expected_testdb_lines = vec![
"some_table,tag1=tag1_value,tag2=tag2_value field1=1i,field2=2.0,field3=\"number three\""
.to_string(),
];
assert_eq!(
reesponse.database_writes.get("_testdb").unwrap(),
response.database_writes.get("_testdb").unwrap(),
&expected_testdb_lines
);
let expected_mytestdb_lines =
vec!["other_table other_field=1i,other_field2=3.14 1302".to_string()];
assert_eq!(
reesponse.database_writes.get("mytestdb").unwrap(),
response.database_writes.get("mytestdb").unwrap(),
&expected_mytestdb_lines
);
}
Expand Down Expand Up @@ -477,8 +477,6 @@ def process_writes(influxdb3_local, table_batches, args=None):
name: "test".into(),
input_lp: Some(lp),
input_file: None,
save_output_to_file: None,
validate_output_file: None,
input_arguments: None,
};

Expand Down

0 comments on commit 80c33ab

Please sign in to comment.