Add an integration test for roles

Add an app with roles to the integration tests. We'll deploy two web
containers and one worker. The worker just sleeps, so we are testing
that the container has booted.
This commit is contained in:
Donal McBreen
2024-03-21 13:30:53 +00:00
parent ba40d026d0
commit 72ace2bf0b
14 changed files with 116 additions and 0 deletions

View File

@@ -42,6 +42,22 @@ class MainTest < IntegrationTest
assert_no_remote_env_file
end
test "app with roles" do
@app = "app_with_roles"
kamal :envify
version = latest_app_version
assert_app_is_down
kamal :deploy
assert_app_is_up version: version
assert_hooks_ran "pre-connect", "pre-build", "pre-deploy", "post-deploy"
assert_container_running host: :vm3, name: "app-workers-#{version}"
end
test "config" do
config = YAML.load(kamal(:config, capture: true))
version = latest_app_version
@@ -115,4 +131,8 @@ class MainTest < IntegrationTest
assert vm1_image_ids.any?
assert vm1_container_ids.any?
end
def assert_container_running(host:, name:)
assert docker_compose("exec #{host} docker ps --filter=name=#{name} -q", capture: true).strip.present?
end
end