This commit is contained in:
Donal McBreen
2025-01-30 15:56:35 +00:00
parent f87bcf5bc6
commit 559bb3667b
2 changed files with 52 additions and 1 deletions

View File

@@ -34,6 +34,30 @@ class SecretsTest < ActiveSupport::TestCase
end
end
test "secret with open bracket" do
with_test_secrets("secrets" => "SECRET1=$(echo 'foo)')") do
assert_equal "foo)", Kamal::Secrets.new["SECRET1"]
end
end
test "secret with close bracket" do
with_test_secrets("secrets" => "SECRET1=$(echo 'foo(')") do
assert_equal "foo(", Kamal::Secrets.new["SECRET1"]
end
end
test "secret with escaped quote" do
with_test_secrets("secrets" => "SECRET1=$(echo \"foo\\\")") do
assert_equal "foo", Kamal::Secrets.new["SECRET1"]
end
end
test "secret with escaped single quote" do
with_test_secrets("secrets" => "SECRET1= $(echo 'foo'\"'\"'bar')") do
assert_equal "foo'bar", Kamal::Secrets.new["SECRET1"]
end
end
test "destinations" do
with_test_secrets("secrets.dest" => "SECRET=DEF", "secrets" => "SECRET=ABC", "secrets-common" => "SECRET=GHI\nSECRET2=JKL") do
assert_equal "ABC", Kamal::Secrets.new["SECRET"]