Skip to content

Commit

Permalink
Merge pull request #1359 from basecamp/add-env-precedence-tests
Browse files Browse the repository at this point in the history
Add tests for env/secret file precedence
  • Loading branch information
djmb authored Jan 17, 2025
2 parents f1a9a09 + dd8cadf commit 9035bd0
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 9035bd0

Please sign in to comment.