Skip to content

Commit

Permalink
chore: remove explicit predicates dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
waynr committed Jan 17, 2025
1 parent d640a93 commit 3328494
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 31 deletions.
19 changes: 0 additions & 19 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ pbjson = "0.6.0"
pbjson-build = "0.6.2"
pbjson-types = "0.6.0"
pin-project-lite = "0.2"
predicates = "3.1.3"
pretty_assertions = "1.4.0"
prost = "0.12.6"
prost-build = "0.12.6"
Expand Down
1 change: 0 additions & 1 deletion influxdb3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,3 @@ test_helpers.workspace = true
tonic.workspace = true
tower.workspace = true
test-log.workspace = true
predicates.workspace = true
35 changes: 25 additions & 10 deletions influxdb3/tests/server/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ use crate::{ConfigProvider, TestServer};
use assert_cmd::cargo::CommandCargoExt;
use assert_cmd::Command as AssertCmd;
use observability_deps::tracing::debug;
use predicates::boolean::PredicateBooleanExt;
use pretty_assertions::assert_eq;
use serde_json::{json, Value};
use test_helpers::assert_contains;
use test_helpers::tempfile::NamedTempFile;
#[cfg(feature = "system-py")]
use test_helpers::tempfile::TempDir;
use test_helpers::{assert_contains, assert_not_contains};

const WRITE_REPORTS_PLUGIN_CODE: &str = r#"
def process_writes(influxdb3_local, table_batches, args=None):
Expand Down Expand Up @@ -122,15 +121,19 @@ async fn test_telemetry_disabled_with_debug_msg() {
let expected_disabled: &str = "Initializing TelemetryStore with upload disabled.";

// validate we get a debug message indicating upload disabled
AssertCmd::cargo_bin("influxdb3")
let output = AssertCmd::cargo_bin("influxdb3")
.unwrap()
.args(serve_args)
.arg("-vv")
.arg("--disable-telemetry-upload")
.timeout(std::time::Duration::from_millis(500))
.assert()
.failure()
.stdout(predicates::str::contains(expected_disabled));
.get_output()
.stdout
.clone();
let output = String::from_utf8(output).expect("must be able to convert output to String");
assert_contains!(output, expected_disabled);
}

#[test_log::test(tokio::test)]
Expand All @@ -145,15 +148,19 @@ async fn test_telemetry_disabled() {

let expected_disabled: &str = "Initializing TelemetryStore with upload disabled.";
// validate no message when debug output disabled
AssertCmd::cargo_bin("influxdb3")
let output = AssertCmd::cargo_bin("influxdb3")
.unwrap()
.args(serve_args)
.arg("-v")
.arg("--disable-telemetry-upload")
.timeout(std::time::Duration::from_millis(500))
.assert()
.failure()
.stdout(predicates::str::contains(expected_disabled).not());
.get_output()
.stdout
.clone();
let output = String::from_utf8(output).expect("must be able to convert output to String");
assert_not_contains!(output, expected_disabled);
}

#[test_log::test(tokio::test)]
Expand All @@ -170,7 +177,7 @@ async fn test_telemetry_enabled_with_debug_msg() {
"Initializing TelemetryStore with upload enabled for http://localhost:9999.";

// validate debug output shows which endpoint we are hitting when telemetry enabled
AssertCmd::cargo_bin("influxdb3")
let output = AssertCmd::cargo_bin("influxdb3")
.unwrap()
.args(serve_args)
.arg("-vv")
Expand All @@ -179,7 +186,11 @@ async fn test_telemetry_enabled_with_debug_msg() {
.timeout(std::time::Duration::from_millis(500))
.assert()
.failure()
.stdout(predicates::str::contains(expected_enabled));
.get_output()
.stdout
.clone();
let output = String::from_utf8(output).expect("must be able to convert output to String");
assert_contains!(output, expected_enabled);
}

#[test_log::test(tokio::test)]
Expand All @@ -196,7 +207,7 @@ async fn test_telementry_enabled() {
"Initializing TelemetryStore with upload enabled for http://localhost:9999.";

// validate no telemetry endpoint reported when debug output not enabled
AssertCmd::cargo_bin("influxdb3")
let output = AssertCmd::cargo_bin("influxdb3")
.unwrap()
.args(serve_args)
.arg("-v")
Expand All @@ -205,7 +216,11 @@ async fn test_telementry_enabled() {
.timeout(std::time::Duration::from_millis(500))
.assert()
.failure()
.stdout(predicates::str::contains(expected_enabled).not());
.get_output()
.stdout
.clone();
let output = String::from_utf8(output).expect("must be able to convert output to String");
assert_not_contains!(output, expected_enabled);
}

#[test_log::test(tokio::test)]
Expand Down

0 comments on commit 3328494

Please sign in to comment.