Put locks in a locks directory. Ensure that locks directory exits on a primary host.

This commit is contained in:
Igor Alexandrov
2024-03-27 12:04:39 +04:00
parent 43672ec9a5
commit cee449c269
7 changed files with 37 additions and 13 deletions

View File

@@ -10,19 +10,19 @@ class CommandsLockTest < ActiveSupport::TestCase
test "status" do
assert_equal \
"stat .kamal/lock-app-production > /dev/null && cat .kamal/lock-app-production/details | base64 -d",
"stat .kamal/locks/app-production > /dev/null && cat .kamal/locks/app-production/details | base64 -d",
new_command.status.join(" ")
end
test "acquire" do
assert_match \
%r{mkdir \.kamal/lock-app-production && echo ".*" > \.kamal/lock-app-production/details}m,
%r{mkdir \.kamal/locks/app-production && echo ".*" > \.kamal/locks/app-production/details}m,
new_command.acquire("Hello", "123").join(" ")
end
test "release" do
assert_match \
"rm .kamal/lock-app-production/details && rm -r .kamal/lock-app-production",
"rm .kamal/locks/app-production/details && rm -r .kamal/locks/app-production",
new_command.release.join(" ")
end