Skip to content

Commit

Permalink
Add tests for env/secret file precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
djmb committed Jan 17, 2025
1 parent f1a9a09 commit dd8cadf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/secrets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ class SecretsTest < ActiveSupport::TestCase
end
end

test "env references" do
with_test_secrets("secrets" => "SECRET1=$SECRET1") do
ENV["SECRET1"] = "ABC"
assert_equal "ABC", Kamal::Secrets.new["SECRET1"]
end
end

test "secrets file value overrides env" do
with_test_secrets("secrets" => "SECRET1=DEF") do
ENV["SECRET1"] = "ABC"
assert_equal "DEF", 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"]
Expand Down

0 comments on commit dd8cadf

Please sign in to comment.