Files
kamal/test/integration/accessory_test.rb
Donal McBreen 6568cef868 Replace Traefik with kamal-proxy
[kamal-proxy](https://github.com/basecamp/kamal-proxy) is a custom
minimal proxy designed specifically for Kamal.

It has some advantages over Traefik:
1. Imperative deployments - we tell it to switch from container A to
   container B, and it waits for container B to start then switches. No
   need to poll for health checks ourselves or mess around with forcing
   health checks to fail.
2. Support for multiple apps - as much as possible, configuration is
   supplied at runtime by the deploy command, allowing us to have
   multiple apps share a proxy without conflicting config.
3. First class support for Kamal operations - rather than trying to
   work out how to make Traefik do what we want, we can build features
   directly into the proxy, making configuration simpler and avoiding
   obscure errors
2024-05-28 15:31:56 +01:00

41 lines
1.1 KiB
Ruby

require_relative "integration_test"
class IntegrationAccessoryTest < IntegrationTest
test "boot, stop, start, restart, logs, remove" do
kamal :envify
kamal :accessory, :boot, :busybox
assert_accessory_running :busybox
kamal :accessory, :stop, :busybox
assert_accessory_not_running :busybox
kamal :accessory, :start, :busybox
assert_accessory_running :busybox
kamal :accessory, :restart, :busybox
assert_accessory_running :busybox
logs = kamal :accessory, :logs, :busybox, capture: true
assert_match /Starting busybox.../, logs
kamal :accessory, :remove, :busybox, "-y"
assert_accessory_not_running :busybox
kamal :env, :delete
end
private
def assert_accessory_running(name)
assert_match /registry:4443\/busybox:1.36.0 "sh -c 'echo \\"Start/, accessory_details(name)
end
def assert_accessory_not_running(name)
assert_no_match /registry:4443\/busybox:1.36.0 "sh -c 'echo \\"Start/, accessory_details(name)
end
def accessory_details(name)
kamal :accessory, :details, name, capture: true
end
end