From 6fd6bd202b52b11b7f78df178d156f6d298f0a7f Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Wed, 3 Apr 2024 17:50:36 -0400 Subject: [PATCH] Regression test for key set in stratis-min --- Makefile | 4 ++-- tests/stratis_min.rs | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7b47bf9d70..5ce7de073b 100644 --- a/Makefile +++ b/Makefile @@ -463,11 +463,11 @@ test-clevis-loop-should-fail-valgrind: ## Test stratisd-min CLI test-stratisd-min: - RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 cargo test --no-default-features --features "engine,min" test_stratisd_min + RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --no-default-features --features "engine,min" test_stratisd_min ## Test stratis-min CLI test-stratis-min: - RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 cargo test --no-default-features --features "engine,min" test_stratis_min + RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --no-default-features --features "engine,min" test_stratis_min ## Run yamllint on workflow files yamllint: diff --git a/tests/stratis_min.rs b/tests/stratis_min.rs index f908d1b6a6..9bfbf49894 100644 --- a/tests/stratis_min.rs +++ b/tests/stratis_min.rs @@ -251,3 +251,21 @@ fn stratis_min_list_default() { fn test_stratis_min_list_defaults() { test_with_stratisd_min_sim(stratis_min_list_default); } + +fn stratis_min_key_set() { + let mut cmd = Command::cargo_bin("stratis-min").unwrap(); + cmd.write_stdin("thisisatestpassphrase\n") + .arg("key") + .arg("set") + .arg("--capture-key") + .arg("testkey"); + cmd.assert().success(); + let mut cmd = Command::cargo_bin("stratis-min").unwrap(); + cmd.arg("key").arg("unset").arg("testkey"); + cmd.assert().success(); +} + +#[test] +fn test_stratis_min_key_set() { + test_with_stratisd_min_sim(stratis_min_key_set); +}