Split lock and connection setup

Allow run the pre-connect hook before the first SSH command is executed,
but only run the locking in `with_lock` blocks.
This commit is contained in:
Donal McBreen
2024-05-20 15:03:38 +01:00
parent 83d0078525
commit 0e73f02743
11 changed files with 125 additions and 91 deletions

View File

@@ -92,6 +92,9 @@ class CliMainTest < CliTestCase
test "deploy when locked" do
Thread.report_on_exception = false
SSHKit::Backend::Abstract.any_instance.stubs(:execute)
Dir.stubs(:chdir)
SSHKit::Backend::Abstract.any_instance.stubs(:execute)
.with { |*args| args == [ :mkdir, "-p", ".kamal" ] }
@@ -113,6 +116,9 @@ class CliMainTest < CliTestCase
test "deploy error when locking" do
Thread.report_on_exception = false
SSHKit::Backend::Abstract.any_instance.stubs(:execute)
Dir.stubs(:chdir)
SSHKit::Backend::Abstract.any_instance.stubs(:execute)
.with { |*args| args == [ :mkdir, "-p", ".kamal" ] }