From c63ec39f0735e62536c3df40eb2b3e66f6bf8b22 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Sat, 28 Sep 2024 20:17:22 -0400 Subject: [PATCH] Added a test for colliding hosts passed via hosts array --- test/configuration_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 814aa26e..21709180 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -377,4 +377,15 @@ class ConfigurationTest < ActiveSupport::TestCase assert_equal "Different roles can't share the same host for SSL: foo.example.com", exception.message end + + test "two proxy ssl roles with same host in a hosts array" do + @deploy_with_roles[:servers]["web"] = { "hosts" => [ "1.1.1.1" ], "proxy" => { "ssl" => true, "hosts" => [ "foo.example.com", "bar.example.com" ] } } + @deploy_with_roles[:servers]["workers"] = { "hosts" => [ "1.1.1.1" ], "proxy" => { "ssl" => true, "hosts" => [ "www.example.com", "foo.example.com" ] } } + + exception = assert_raises(Kamal::ConfigurationError) do + Kamal::Configuration.new(@deploy_with_roles) + end + + assert_equal "Different roles can't share the same host for SSL: foo.example.com", exception.message + end end