fix assert_cmd::cargo_bin deprecation warning

This commit is contained in:
ppom 2026-02-09 12:00:00 +01:00
commit 6914f19fb8
No known key found for this signature in database
6 changed files with 20 additions and 23 deletions

View file

@ -1,10 +1,10 @@
use std::error::Error;
use assert_cmd::Command;
use assert_cmd::cargo::cargo_bin_cmd;
#[test]
fn load_conf_directory() -> Result<(), Box<dyn Error>> {
let mut cmd = Command::cargo_bin("reaction")?;
let mut cmd = cargo_bin_cmd!("reaction");
cmd.args([
"test-config",
"--verbose",
@ -70,7 +70,7 @@ streams:
fn example_configs_are_equal() {
let outputs = ["config/example.yml", "config/example.jsonnet"]
.map(|config_path| {
let mut cmd = Command::cargo_bin("reaction").unwrap();
let mut cmd = cargo_bin_cmd!("reaction");
cmd.args(["test-config", "--config", config_path]);
cmd.assert().success().get_output().stdout.clone()
})

View file

@ -1,6 +1,6 @@
use std::{error::Error, path::Path, process::Stdio, thread::sleep, time::Duration};
use assert_cmd::Command;
use assert_cmd::cargo::cargo_bin_cmd;
use assert_fs::prelude::*;
use nix::sys::signal;
use predicates::prelude::predicate;
@ -14,7 +14,7 @@ fn actions_delayed_and_on_exit() -> Result<(), Box<dyn Error>> {
.child("config.jsonnet")
.write_file(Path::new("tests/test-conf/test-after.jsonnet"))?;
let mut cmd = Command::cargo_bin("reaction")?;
let mut cmd = cargo_bin_cmd!("reaction");
cmd.args(["start", "--socket", "./s", "--config", "./config.jsonnet"]);
cmd.current_dir(tmp_dir.path());
cmd.timeout(Duration::from_secs(5));
@ -46,7 +46,7 @@ fn kill_stream_on_exit() -> Result<(), Box<dyn Error>> {
.child("config.jsonnet")
.write_file(Path::new("tests/test-conf/test-shutdown.jsonnet"))?;
let cmd = Command::cargo_bin("reaction")?;
let cmd = cargo_bin_cmd!("reaction");
let mut cmd = std::process::Command::new(cmd.get_program());
cmd.args(["start", "--socket", "./s", "--config", "./config.jsonnet"]);
cmd.current_dir(tmp_dir.path());
@ -103,7 +103,7 @@ fn non_utf8_is_stripped() -> Result<(), Box<dyn Error>> {
.child("config.jsonnet")
.write_file(Path::new("tests/test-conf/test-binary-input.jsonnet"))?;
let mut cmd = Command::cargo_bin("reaction")?;
let mut cmd = cargo_bin_cmd!("reaction");
cmd.args(["start", "--socket", "./s", "--config", "config.jsonnet"]);
cmd.current_dir(tmp_dir.path());
cmd.timeout(std::time::Duration::from_secs(1));
@ -124,7 +124,7 @@ fn capture_streams_stderr() -> Result<(), Box<dyn Error>> {
.child("config.jsonnet")
.write_file(Path::new("tests/test-conf/test-stream-stderr.jsonnet"))?;
let mut cmd = Command::cargo_bin("reaction")?;
let mut cmd = cargo_bin_cmd!("reaction");
cmd.args(["start", "--socket", "./s", "--config", "config.jsonnet"]);
cmd.current_dir(tmp_dir.path());
cmd.timeout(std::time::Duration::from_secs(1));
@ -149,7 +149,7 @@ fn manualy_trigger_filter() -> Result<(), Box<dyn Error>> {
.write_file(Path::new("tests/test-conf/test-trigger.jsonnet"))?;
// start daemon
let cmd = Command::cargo_bin("reaction")?;
let cmd = cargo_bin_cmd!("reaction");
let program = cmd.get_program();
let mut cmd = std::process::Command::new(program);
cmd.args(["start", "--socket", "./s", "--config", "config.jsonnet"]);
@ -181,7 +181,7 @@ fn manualy_trigger_filter() -> Result<(), Box<dyn Error>> {
let socket_path = socket.path().to_str().unwrap();
// trigger event manually
let mut cmd_trigger = Command::cargo_bin("reaction")?;
let mut cmd_trigger = cargo_bin_cmd!("reaction");
cmd_trigger.current_dir(tmp_dir.path());
cmd_trigger.args(["trigger", "--socket", socket_path, "s1.f1", "num=95"]);
cmd_trigger.timeout(Duration::from_secs(1));
@ -221,7 +221,7 @@ fn filter_regex_match_eol() -> Result<(), Box<dyn Error>> {
.child("config.jsonnet")
.write_file(Path::new("tests/test-conf/test-eol-match.jsonnet"))?;
let mut cmd = Command::cargo_bin("reaction")?;
let mut cmd = cargo_bin_cmd!("reaction");
cmd.args(["start", "--socket", "./s", "--config", "config.jsonnet"]);
cmd.current_dir(tmp_dir.path());
cmd.timeout(std::time::Duration::from_secs(1));

View file

@ -1,6 +1,6 @@
use std::{error::Error, path::Path, time::Duration};
use assert_cmd::Command;
use assert_cmd::cargo::cargo_bin_cmd;
use assert_fs::prelude::*;
use predicates::prelude::predicate;
@ -13,7 +13,7 @@ fn resume_action() -> Result<(), Box<dyn Error>> {
.write_file(Path::new("tests/test-conf/test-resume-action.jsonnet"))?;
// first run
let mut cmd = Command::cargo_bin("reaction")?;
let mut cmd = cargo_bin_cmd!("reaction");
cmd.args(["start", "--socket", "./s", "--config", "./config.jsonnet"]);
cmd.current_dir(tmp_dir.path());
cmd.timeout(Duration::from_secs(5));
@ -25,7 +25,7 @@ fn resume_action() -> Result<(), Box<dyn Error>> {
tmp_dir.child("log").assert(&expected);
// second run, expect to resume action
let mut cmd = Command::cargo_bin("reaction")?;
let mut cmd = cargo_bin_cmd!("reaction");
cmd.args(["start", "--socket", "./s", "--config", "./config.jsonnet"]);
cmd.current_dir(tmp_dir.path());
cmd.timeout(Duration::from_secs(5));

View file

@ -1,6 +1,6 @@
use std::{fs::read_to_string, path::Path, thread, time::Duration};
use assert_cmd::Command;
use assert_cmd::{Command, cargo::cargo_bin_cmd};
use assert_fs::prelude::*;
const SECRET_KEY_A: &str = "g7U1LPq2cgGSyk6CH_v1QpoXowSFKVQ8IcFljd_ZKGw=";
@ -100,8 +100,7 @@ fn launch_node(config: String, my_secret: &'static str, expected_output: Vec<&'s
.write_file(Path::new("./target/debug/reaction-plugin-cluster"))
.unwrap();
let output = Command::cargo_bin("reaction")
.unwrap()
let output = cargo_bin_cmd!("reaction")
.args([
"start",
"--socket",

View file

@ -1,6 +1,6 @@
use std::{path::Path, time::Duration};
use assert_cmd::Command;
use assert_cmd::{Command, cargo::cargo_bin_cmd};
use assert_fs::prelude::*;
use predicates::prelude::predicate;
@ -23,8 +23,7 @@ fn plugin_virtual() {
.write_file(Path::new("./target/debug/reaction-plugin-virtual"))
.unwrap();
Command::cargo_bin("reaction")
.unwrap()
cargo_bin_cmd!("reaction")
.args(["start", "--socket", "./s", "--config", "./config.jsonnet"])
.current_dir(tmp_dir.path())
.timeout(Duration::from_secs(5))

View file

@ -1,6 +1,6 @@
use std::{path::Path, time::Duration};
use assert_cmd::Command;
use assert_cmd::cargo::cargo_bin_cmd;
use assert_fs::{TempDir, prelude::*};
use predicates::prelude::predicate;
@ -80,8 +80,7 @@ fn run_reaction(tmp_dir: &TempDir) {
.write_file(Path::new("tests/start_stop.jsonnet"))
.unwrap();
Command::cargo_bin("reaction")
.unwrap()
cargo_bin_cmd!("reaction")
.args(["start", "--socket", "./s", "--config", "./config.jsonnet"])
.current_dir(tmp_dir.path())
.timeout(Duration::from_secs(5))