Pass around Roles instead of Strings

Avoid looking up roles by names everywhere. This avoids the awkward
role/role_config naming as well.
This commit is contained in:
Donal McBreen
2024-03-08 08:44:35 +00:00
parent 52bb40add0
commit 4966d52919
12 changed files with 61 additions and 60 deletions

View File

@@ -300,14 +300,14 @@ class ConfigurationTest < ActiveSupport::TestCase
end
test "primary role" do
assert_equal "web", @config.primary_role
assert_equal "web", @config.primary_role.name
config = Kamal::Configuration.new(@deploy_with_roles.deep_merge({
servers: { "alternate_web" => { "hosts" => [ "1.1.1.4", "1.1.1.5" ] } },
primary_role: "alternate_web" } ))
assert_equal "alternate_web", config.primary_role
assert_equal "alternate_web", config.primary_role.name
assert_equal "1.1.1.4", config.primary_host
assert config.role(:alternate_web).primary?
assert config.role(:alternate_web).running_traefik?