summaryrefslogtreecommitdiff
path: root/tests/package_installer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/package_installer.rs')
-rw-r--r--tests/package_installer.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/package_installer.rs b/tests/package_installer.rs
index 76d8683..74bf9aa 100644
--- a/tests/package_installer.rs
+++ b/tests/package_installer.rs
@@ -102,3 +102,31 @@ fn build_plan_compiles_its_typed_package_request() {
);
assert_eq!(request.selectors(), ["^kernel-(image|modules-())-(rt)$"]);
}
+
+#[test]
+fn sudo_user_runner_executes_hasher_commands_as_the_configured_user() {
+ let runner = alt_controller_image::hasher::SudoUserRunner::new("hermes");
+ let invocation = runner.wrap(Invocation::new("hsh", ["--version"]));
+
+ assert_eq!(
+ invocation,
+ Invocation::new("sudo", ["-n", "-u", "hermes", "hsh", "--version"])
+ );
+ let preparation = runner.prepare_workdir(std::path::Path::new("/build/work"));
+ assert_eq!(
+ preparation,
+ Invocation::new(
+ "sudo",
+ [
+ "-n",
+ "install",
+ "-d",
+ "-o",
+ "hermes",
+ "-g",
+ "hermes",
+ "/build/work"
+ ]
+ )
+ );
+}