Allow skipping master key

This commit is contained in:
David Heinemeier Hansson
2023-01-24 13:19:12 +01:00
parent 200f12a4a1
commit 08cac72475
5 changed files with 40 additions and 6 deletions

View File

@@ -1,10 +1,10 @@
require "test_helper"
require "mrsk/configuration"
ENV["RAILS_MASTER_KEY"] = "456"
class ConfigurationTest < ActiveSupport::TestCase
setup do
ENV["RAILS_MASTER_KEY"] = "456"
@deploy = {
service: "app", image: "dhh/app",
registry: { "username" => "dhh", "password" => "secret" },
@@ -21,6 +21,10 @@ class ConfigurationTest < ActiveSupport::TestCase
@config_with_roles = Mrsk::Configuration.new(@deploy_with_roles)
end
teardown do
ENV["RAILS_MASTER_KEY"] = nil
end
test "ensure valid keys" do
assert_raise(ArgumentError) do
Mrsk::Configuration.new(@deploy.tap { _1.delete(:service) })
@@ -134,6 +138,11 @@ class ConfigurationTest < ActiveSupport::TestCase
assert_equal "456", @config.master_key
end
test "skip master key" do
config = Mrsk::Configuration.new(@deploy.tap { |c| c[:skip_master_key] = true })
assert_nil @config.master_key
end
test "volume_args" do
assert_equal ["--volume", "/local/path:/container/path"], @config.volume_args
end