Skip to content

Commit

Permalink
Changed error message
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanharan committed Oct 19, 2024
1 parent db9fa5b commit 7402e40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/kamal/secrets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def [](key)
if secrets_files.present?
raise Kamal::ConfigurationError, "Secret '#{key}' not found in #{secrets_files.join(", ")}"
else
raise Kamal::ConfigurationError, "Secret '#{key}' not found, cannot find secret files #{secrets_filenames.join(", ")}"
raise Kamal::ConfigurationError, "Secret '#{key}' not found, no secret files (#{secrets_filenames.join(", ")}) provided"
end
end

Expand Down
6 changes: 4 additions & 2 deletions test/secrets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ class SecretsTest < ActiveSupport::TestCase

test "no secrets files" do
with_test_secrets do
assert_raises(Kamal::ConfigurationError, "Secret 'SECRET' not found, cannot find secret files .kamal/secrets-common, .kamal/secrets") do
error = assert_raises(Kamal::ConfigurationError) do
Kamal::Secrets.new["SECRET"]
end
assert_equal "Secret 'SECRET' not found, no secret files (.kamal/secrets-common, .kamal/secrets) provided", error.message

assert_raises(Kamal::ConfigurationError, "Secret 'SECRET' not found, cannot find secret files .kamal/secrets-common, .kamal/secrets.dest") do
error = assert_raises(Kamal::ConfigurationError) do
Kamal::Secrets.new(destination: "dest")["SECRET"]
end
assert_equal "Secret 'SECRET' not found, no secret files (.kamal/secrets-common, .kamal/secrets.dest) provided", error.message
end
end
end

0 comments on commit 7402e40

Please sign in to comment.