Merge pull request #1507 from basecamp/fix-accessory-setup
Fix accessory setup
This commit is contained in:
@@ -251,6 +251,19 @@ class CliAccessoryTest < CliTestCase
|
||||
end
|
||||
end
|
||||
|
||||
test "boot with web role filter" do
|
||||
run_command("boot", "redis", "-r", "web").tap do |output|
|
||||
assert_match "docker run --name app-redis --detach --restart unless-stopped --network kamal --log-opt max-size=\"10m\" --publish 6379:6379 --env-file .kamal/apps/app/env/accessories/redis.env --volume $PWD/app-redis/data:/data --label service=\"app-redis\" redis:latest on 1.1.1.1", output
|
||||
assert_match "docker run --name app-redis --detach --restart unless-stopped --network kamal --log-opt max-size=\"10m\" --publish 6379:6379 --env-file .kamal/apps/app/env/accessories/redis.env --volume $PWD/app-redis/data:/data --label service=\"app-redis\" redis:latest on 1.1.1.2", output
|
||||
end
|
||||
end
|
||||
|
||||
test "boot with workers role filter" do
|
||||
run_command("boot", "redis", "-r", "workers").tap do |output|
|
||||
assert_no_match "docker run", output
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def run_command(*command)
|
||||
stdouted { Kamal::Cli::Accessory.start([ *command, "-c", "test/fixtures/deploy_with_accessories_with_different_registries.yml" ]) }
|
||||
|
||||
@@ -17,6 +17,9 @@ class AccessoryTest < IntegrationTest
|
||||
logs = kamal :accessory, :logs, :busybox, capture: true
|
||||
assert_match /Starting busybox.../, logs
|
||||
|
||||
boot = kamal :accessory, :boot, :busybox, capture: true
|
||||
assert_match /Skipping booting `busybox` on vm1, vm2, a container already exists/, boot
|
||||
|
||||
kamal :accessory, :remove, :busybox, "-y"
|
||||
assert_accessory_not_running :busybox
|
||||
end
|
||||
|
||||
@@ -11,7 +11,7 @@ class IntegrationTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
teardown do
|
||||
if !passed? && ENV["DEBUG"]
|
||||
if !passed? && ENV["DEBUG_CONTAINER_LOGS"]
|
||||
[ :deployer, :vm1, :vm2, :shared, :load_balancer, :registry ].each do |container|
|
||||
puts
|
||||
puts "Logs for #{container}:"
|
||||
|
||||
Reference in New Issue
Block a user