Merge branch 'basecamp:main' into buildpacks
This commit is contained in:
20
test/configuration/env/tags_test.rb
vendored
20
test/configuration/env/tags_test.rb
vendored
@@ -92,7 +92,25 @@ class ConfigurationEnvTagsTest < ActiveSupport::TestCase
|
||||
}
|
||||
|
||||
config = Kamal::Configuration.new(deploy)
|
||||
assert_equal "hello", config.role("web").env("1.1.1.1").secrets["PASSWORD"]
|
||||
assert_equal "PASSWORD=hello\n", config.role("web").env("1.1.1.1").secrets_io.string
|
||||
end
|
||||
end
|
||||
|
||||
test "aliased tag secret env" do
|
||||
with_test_secrets("secrets" => "PASSWORD=hello\nALIASED_PASSWORD=aliased_hello") do
|
||||
deploy = {
|
||||
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" },
|
||||
servers: [ { "1.1.1.1" => "secrets" } ],
|
||||
builder: { "arch" => "amd64" },
|
||||
env: {
|
||||
"tags" => {
|
||||
"secrets" => { "secret" => [ "PASSWORD:ALIASED_PASSWORD" ] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
config = Kamal::Configuration.new(deploy)
|
||||
assert_equal "PASSWORD=aliased_hello\n", config.role("web").env("1.1.1.1").secrets_io.string
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -48,6 +48,20 @@ class ConfigurationEnvTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test "aliased secrets" do
|
||||
with_test_secrets("secrets" => "ALIASED_PASSWORD=hello") do
|
||||
config = {
|
||||
"secret" => [ "PASSWORD:ALIASED_PASSWORD" ],
|
||||
"clear" => {}
|
||||
}
|
||||
|
||||
assert_config \
|
||||
config: config,
|
||||
clear: {},
|
||||
secrets: { "PASSWORD" => "hello" }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def assert_config(config:, clear: {}, secrets: {})
|
||||
env = Kamal::Configuration::Env.new config: config, secrets: Kamal::Secrets.new
|
||||
|
||||
Reference in New Issue
Block a user