mirror of
https://gitlab.cern.ch/wotsubo/psboard-qaqc-postprocess.git
synced 2025-07-01 17:19:29 +09:00
added: use out_runid.csv as default output path
This commit is contained in:
parent
1ec3f8107c
commit
772f7a155f
4 changed files with 34 additions and 10 deletions
25
tests/cli.rs
25
tests/cli.rs
|
@ -1,11 +1,13 @@
|
|||
mod integrated_test {
|
||||
use std::{
|
||||
fs::File,
|
||||
env::current_dir,
|
||||
ffi::OsString,
|
||||
fs::{self, read_dir, File},
|
||||
io::{BufRead, BufReader},
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
use anyhow::Result;
|
||||
use anyhow::{Context, Result};
|
||||
use assert_cmd::Command;
|
||||
use itertools::Itertools;
|
||||
use predicates::prelude::*;
|
||||
|
@ -67,17 +69,28 @@ mod integrated_test {
|
|||
#[test]
|
||||
fn partial_log() -> Result<()> {
|
||||
let test_out_dir = assert_fs::TempDir::new()?;
|
||||
let test_out = PathBuf::new().join(&test_out_dir).join("out.csv");
|
||||
fs::copy(
|
||||
"./tests/example_logs/valid/84.log",
|
||||
test_out_dir.join("84.log"),
|
||||
)
|
||||
.context("Error preparing source file")?;
|
||||
|
||||
let mut cmd = Command::cargo_bin("psb-qaqc")?;
|
||||
cmd.current_dir("tests")
|
||||
cmd.current_dir(&test_out_dir)
|
||||
.arg("add-master-log")
|
||||
.arg("./example_logs/valid/84.log")
|
||||
.arg(test_out.as_path())
|
||||
.arg("84.log")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("Creating new file"));
|
||||
|
||||
assert!(read_dir(&test_out_dir)
|
||||
.context("Failed to read dir")?
|
||||
.any(|entry| {
|
||||
entry
|
||||
.map_or(OsString::from(""), |entry| entry.file_name())
|
||||
.eq("out_84.csv")
|
||||
}));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue