Get lock status by executing directly

Getting the lock status with invoke passes through any options from the
original command which will raise an exception if they are not also
valid for the lock status command.

Fixes https://github.com/mrsked/mrsk/issues/239
This commit is contained in:
Donal McBreen
2023-04-25 15:15:55 +01:00
parent 1a7d123746
commit cd668066ff
2 changed files with 3 additions and 2 deletions

View File

@@ -64,7 +64,8 @@ class CliMainTest < CliTestCase
.with { |*arg| arg[0..1] == [:mkdir, :mrsk_lock] }
.raises(RuntimeError, "mkdir: cannot create directory mrsk_lock: File exists")
Mrsk::Cli::Base.any_instance.expects(:invoke).with("mrsk:cli:lock:status", [])
SSHKit::Backend::Abstract.any_instance.expects(:execute)
.with(:stat, :mrsk_lock, ">", "/dev/null", "&&", :cat, "mrsk_lock/details", "|", :base64, "-d")
assert_raises(Mrsk::Cli::LockError) do
run_command("deploy")