diff --git a/tests/unit/test_compose_file.cpp b/tests/unit/test_compose_file.cpp index 40e8ede..cf77d60 100644 --- a/tests/unit/test_compose_file.cpp +++ b/tests/unit/test_compose_file.cpp @@ -529,6 +529,21 @@ TEST_CASE("compose file: service volumes -- bind mounts (absolute-resolved, ro), CHECK_FALSE(load_compose_file(relative_target).has_value()); } +TEST_CASE("compose file: duplicate top-level volume name is an error", "[unit]") { + ScratchXdgDirs scratch; + // A duplicate YAML mapping key under volumes: -- same shape as the + // already-tested duplicate service name (libyaml keeps both pairs + // rather than deduplicating). + auto path = write_compose(scratch.path(), + "services:\n" + " web:\n" + " image: busybox:latest\n" + "volumes:\n" + " applog:\n" + " applog:\n"); + CHECK_FALSE(load_compose_file(path).has_value()); +} + TEST_CASE("compose file: validate_compose_external_state -- env_file existence, external network existence", "[unit]") { ScratchXdgDirs scratch;