Skip to content

Commit

Permalink
fix(inclusion_monitor): test data paths
Browse files Browse the repository at this point in the history
  • Loading branch information
alextes committed Feb 8, 2024
1 parent 6457670 commit 263fd69
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
19 changes: 10 additions & 9 deletions src/phoenix/inclusion_monitor/loki_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,23 @@ mod tests {

#[test]
fn parse_into_logs_test() {
let str =
File::open("src/phoenix/inclusion_monitor/log_stats/test_data/late_call_8365873.json")
.map(|mut file| {
let mut str = String::new();
file.read_to_string(&mut str).unwrap();
str
})
.unwrap();
let str = File::open(
"src/phoenix/inclusion_monitor/loki_client/test_data/late_call_8365873.json",
)
.map(|mut file| {
let mut str = String::new();
file.read_to_string(&mut str).unwrap();
str
})
.unwrap();

loki_res_into_json_logs(&str).unwrap();
}

#[test]
fn error_messages_test() {
let str =
File::open("src/phoenix/inclusion_monitor/log_stats/test_data/error_8365565.json")
File::open("src/phoenix/inclusion_monitor/loki_client/test_data/error_8365565.json")
.map(|mut file| {
let mut str = String::new();
file.read_to_string(&mut str).unwrap();
Expand Down
34 changes: 18 additions & 16 deletions src/phoenix/inclusion_monitor/loki_client/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,29 +108,31 @@ mod tests {

#[test]
fn parse_published_log_test() {
let str =
File::open("src/phoenix/inclusion_monitor/log_stats/test_data/published_8371236.json")
.map(|mut file| {
let mut str = String::new();
file.read_to_string(&mut str).unwrap();
str
})
.unwrap();
let str = File::open(
"src/phoenix/inclusion_monitor/loki_client/test_data/published_8371236.json",
)
.map(|mut file| {
let mut str = String::new();
file.read_to_string(&mut str).unwrap();
str
})
.unwrap();

let logs = loki_res_into_json_logs(&str).unwrap();
published_stats_from_logs(&logs).unwrap();
}

#[test]
fn parse_late_call_log_test() {
let str =
File::open("src/phoenix/inclusion_monitor/log_stats/test_data/late_call_8365873.json")
.map(|mut file| {
let mut str = String::new();
file.read_to_string(&mut str).unwrap();
str
})
.unwrap();
let str = File::open(
"src/phoenix/inclusion_monitor/loki_client/test_data/late_call_8365873.json",
)
.map(|mut file| {
let mut str = String::new();
file.read_to_string(&mut str).unwrap();
str
})
.unwrap();

let logs = loki_res_into_json_logs(&str).unwrap();
late_call_stats_from_logs(&logs).unwrap();
Expand Down

0 comments on commit 263fd69

Please sign in to comment.