use anyhow::Result; use assert_cmd::Command; use common::{BIN, GNUPGHOME, PASSWORD_STORE_DIR}; use tempfile::tempdir; mod common; const KUBEPASSGEN: &str = r#" [opaque.namespace.name] SECRET="test_pass" "#; const EXPECTED: &str = r#"apiVersion: v1 kind: ConfigMap metadata: name: empty-6ct58987ht namespace: namespace --- apiVersion: v1 data: SECRET: VGVzdFNlY3JldA== kind: Secret metadata: name: name-h87c7f9d6c namespace: namespace type: Opaque "#; #[test] fn wrap() -> Result<()> { let gpg_home = tempdir()?; let work_dir = tempdir()?; common::setup(&gpg_home, &work_dir, &KUBEPASSGEN)?; Command::cargo_bin(BIN)? .env(GNUPGHOME, gpg_home.path()) .env(PASSWORD_STORE_DIR, work_dir.path().join(".password-store")) .current_dir(work_dir.path()) .arg("kustomize") .assert() .success() .stdout(EXPECTED); Ok(()) }