Add allow_empty_roles to control aborting on roles with no hosts.

This added flexibility allows you to define base roles that might not
necessarily exist in each deploy destination.
This commit is contained in:
Matthew Kent
2023-11-12 08:33:08 -08:00
parent 073f745677
commit 60187cc3a4
3 changed files with 32 additions and 6 deletions

View File

@@ -165,6 +165,16 @@ class ConfigurationTest < ActiveSupport::TestCase
end
end
test "allow_empty_roles" do
assert_silent do
Kamal::Configuration.new @deploy.merge(servers: { "web" => %w[ web ], "workers" => { "hosts" => %w[ ] } }, allow_empty_roles: true)
end
assert_raises(ArgumentError) do
Kamal::Configuration.new @deploy.merge(servers: { "web" => %w[], "workers" => { "hosts" => %w[] } }, allow_empty_roles: true)
end
end
test "volume_args" do
assert_equal ["--volume", "/local/path:/container/path"], @config.volume_args
end