From 1ed2bdf3755046d5cbed0f7c3873fdaa9d5394d1 Mon Sep 17 00:00:00 2001 From: Lucas Kent Date: Fri, 17 Mar 2023 12:57:28 +1100 Subject: [PATCH] Improve docker-compose.yaml validation with this one small trick (#1084) --- test-helpers/src/docker_compose.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test-helpers/src/docker_compose.rs b/test-helpers/src/docker_compose.rs index 5dcdaadb5..6707949f5 100644 --- a/test-helpers/src/docker_compose.rs +++ b/test-helpers/src/docker_compose.rs @@ -76,12 +76,14 @@ impl DockerCompose { panic!("Could not find docker-compose. Have you installed it?"); } + // It is critical that clean_up is run before everything else as the internal `docker-compose` commands act as validation + // for the docker-compose.yaml file that we later manually parse with poor error handling + DockerCompose::clean_up(file_path).unwrap(); + let service_to_image = DockerCompose::get_service_to_image(file_path); DockerCompose::build_images(&service_to_image); - DockerCompose::clean_up(file_path).unwrap(); - run_command("docker-compose", &["-f", file_path, "up", "-d"]).unwrap(); DockerCompose::wait_for_containers_to_startup(service_to_image, file_path);