fix: allow configurations without web roles

This commit is contained in:
Yoel Cabo
2023-11-12 09:39:07 +01:00
parent 8f53104d00
commit 87cb8c1f71
7 changed files with 31 additions and 10 deletions

View File

@@ -64,9 +64,14 @@ class CliHealthcheckTest < CliTestCase
end
assert_match "container not ready (unhealthy)", exception.message
end
test "does not perform if primary does not have traefik" do
SSHKit::Backend::Abstract.any_instance.expects(:execute).never
run_command("perform", config_file: "test/fixtures/deploy_workers_only.yml")
end
private
def run_command(*command)
stdouted { Kamal::Cli::Healthcheck.start([*command, "-c", "test/fixtures/deploy_with_accessories.yml"]) }
def run_command(*command, config_file: "test/fixtures/deploy_with_accessories.yml")
stdouted { Kamal::Cli::Healthcheck.start([*command, "-c", config_file]) }
end
end

View File

@@ -58,9 +58,9 @@ class ConfigurationTest < ActiveSupport::TestCase
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3" ], @config_with_roles.all_hosts
end
test "primary web host" do
assert_equal "1.1.1.1", @config.primary_web_host
assert_equal "1.1.1.1", @config_with_roles.primary_web_host
test "primary host" do
assert_equal "1.1.1.1", @config.primary_host
assert_equal "1.1.1.1", @config_with_roles.primary_host
end
test "traefik hosts" do

10
test/fixtures/deploy_workers_only.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
service: app
image: dhh/app
servers:
workers:
hosts:
- 1.1.1.1
- 1.1.1.2
registry:
username: user
password: pw