Skip to content

Commit

Permalink
Don't generate reports when not asked for it, closes #1072
Browse files Browse the repository at this point in the history
Signed-off-by: Heinz N. Gies <heinz@licenser.net>
  • Loading branch information
Licenser committed Jul 15, 2021
1 parent 0bf2c1c commit c687436
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Fix some errors in otel pb <-> json translation
- Fix windowed queries emitting events with `null` metadata on tick
- Fix sorting for artefacts
- Fix issde where the test framework would generate reports without being asked for it [#1072](https://github.com/tremor-rs/tremor-runtime/issues/1072)

## 0.11.4

Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions tremor-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ pretty_assertions = "0.7.2"

[dependencies]
anyhow = "1"
async-std = { version="1.9", features=["unstable"] }
clap = { version="3.0.0-beta.2", features=["yaml", "color"] }
async-std = { version = "1.9", features = ["unstable"] }
clap = { version = "3.0.0-beta.2", features = ["yaml", "color"] }
clap_generate = "3.0.0-beta.2"
difference = "2"
dirs-next = "2"
Expand All @@ -35,30 +35,29 @@ log4rs = "1.0.0"
serde = "1"
serde_derive = "1"
serde_yaml = "0.8"
simd-json = { version="0.4", features=["known-key"] }
simd-json = { version = "0.4", features = ["known-key"] }
# we need to stick with 0.2.26 as it includes its own libc
# which allows us to build on older systems like centos 7
# issues to track until we can loosen those restrictions:
# - https://github.com/microsoft/snmalloc/issues/328
# - https://github.com/SchrodingerZhu/snmalloc-rs/issues/145
snmalloc-rs = { version="=0.2.26", optional=false }
snmalloc-sys = { version="=0.2.26", optional=false }
snmalloc-rs = { version = "=0.2.26", optional = false }
snmalloc-sys = { version = "=0.2.26", optional = false }
surf = "=2.2.0"
tide = "0.16"
tremor-api = { path="../tremor-api" }
tremor-common = { path="../tremor-common" }
tremor-pipeline = { path="../tremor-pipeline" }
tremor-runtime = { path="../" }
tremor-script = { path="../tremor-script" }
tremor-api = { path = "../tremor-api" }
tremor-common = { path = "../tremor-common" }
tremor-pipeline = { path = "../tremor-pipeline" }
tremor-runtime = { path = "../" }
tremor-script = { path = "../tremor-script" }
url = "2"
# mimalloc-rs = { version = "0.1", default-features = true, optional = true }
# allocator_api = "0.6.0"
error-chain = "0.12"
globwalk = "0.8"
port_scanner = "0.1"
serde_json = "1.0"
shell-words = "1.0"
tch = { version="*", optional=true }
tch = { version = "*", optional = true }
termcolor = "1.1"
[[bin]]
name = "tremor"
Expand Down
1 change: 0 additions & 1 deletion tremor-cli/src/cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ subcommands:
long: report
required: false
takes_value: true
default_value: "report.json"
- INCLUDES:
help: Optional tags to filter test executions by
short: i
Expand Down
8 changes: 4 additions & 4 deletions tremor-cli/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ fn suite_unit(
pub(crate) fn run_cmd(matches: &ArgMatches) -> Result<()> {
let kind: test::TestKind = matches.value_of("MODE").unwrap_or_default().try_into()?;
let path = matches.value_of("PATH").unwrap_or_default();
let report = matches.value_of("REPORT").unwrap_or_default();
let report = matches.value_of("REPORT");
let quiet = matches.is_present("QUIET");
let mut includes: Vec<String> = if matches.is_present("INCLUDES") {
if let Some(matches) = matches.values_of("INCLUDES") {
Expand Down Expand Up @@ -344,9 +344,9 @@ pub(crate) fn run_cmd(matches: &ArgMatches) -> Result<()> {
reports,
stats: stats_map,
};
let mut file = file::create(report)?;

if let Ok(result) = serde_json::to_string(&test_run) {
if let Some(report) = report {
let mut file = file::create(report)?;
let result = simd_json::to_string(&test_run)?;
file.write_all(&result.as_bytes())
.map_err(|e| Error::from(format!("Failed to write report to `{}`: {}", report, e)))?;
}
Expand Down
4 changes: 2 additions & 2 deletions tremor-cli/src/test/after.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ impl After {
}

pub(crate) fn load_after(path: &Path) -> Result<After> {
let tags_data = slurp_string(path)?;
match serde_json::from_str(&tags_data) {
let mut tags_data = slurp_string(path)?;
match simd_json::from_str(&mut tags_data) {
Ok(s) => Ok(s),
Err(_not_well_formed) => Err(Error::from(format!(
"Unable to load `after.json` from path: {}",
Expand Down
4 changes: 2 additions & 2 deletions tremor-cli/src/test/before.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ fn default_min_await_secs() -> u64 {
}

pub(crate) fn load_before(path: &Path) -> Result<Before> {
let tags_data = slurp_string(path)?;
match serde_json::from_str(&tags_data) {
let mut tags_data = slurp_string(path)?;
match simd_json::from_str(&mut tags_data) {
Ok(s) => Ok(s),
Err(e) => Err(Error::from(format!(
"Invalid `before.json` in path `{}`: {}",
Expand Down
2 changes: 1 addition & 1 deletion tremor-cli/src/test/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub(crate) type Tags = Vec<String>;
pub(crate) fn maybe_slurp_tags(path: &Path) -> Tags {
let tags_data = slurp_string(path);
match tags_data {
Ok(tags_data) => serde_json::from_str(&tags_data).unwrap_or_default(),
Ok(mut tags_data) => simd_json::from_str(&mut tags_data).unwrap_or_default(),
Err(_not_found) => vec![],
}
}
Expand Down

0 comments on commit c687436

Please sign in to comment.