Skip to content

Commit

Permalink
add logging tests from the suite (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
marijncv authored Jan 10, 2025
1 parent 02d2476 commit b9675a6
Show file tree
Hide file tree
Showing 3 changed files with 548 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libraries/pipes/implementations/rust/pipes.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
error_reporting = false

[messages]
log = false
log = true
report_custom_message = false
report_asset_materialization = false
report_asset_check = false
Expand Down
19 changes: 18 additions & 1 deletion libraries/pipes/implementations/rust/src/bin/pipes_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clap::Parser;
use dagster_pipes_rust::{open_dagster_pipes, DagsterPipesError};
use dagster_pipes_rust::{open_dagster_pipes, DagsterPipesError, MessageWriter, PipesContext};
use dagster_pipes_rust::{DAGSTER_PIPES_CONTEXT_ENV_VAR, DAGSTER_PIPES_MESSAGES_ENV_VAR};
use std::collections::HashMap;
use std::fs::File;
Expand Down Expand Up @@ -49,5 +49,22 @@ pub fn main() -> Result<(), DagsterPipesError> {
serde_json::from_reader(file).expect("extras could not be parsed");
assert_eq!(context.data.extras, Some(json));
}

match args.test_name.as_str() {
"test_message_log" => test_message_log(context),
_ => Ok(()),
}?;
Ok(())
}

fn test_message_log<W>(mut context: PipesContext<W>) -> Result<(), DagsterPipesError>
where
W: MessageWriter,
{
context.logger.debug("Debug message")?;
context.logger.info("Info message")?;
context.logger.warning("Warning message")?;
context.logger.error("Error message")?;
context.logger.critical("Critical message")?;
Ok(())
}
Loading

0 comments on commit b9675a6

Please sign in to comment.