diff --git a/internal/constant/compose.go b/internal/constant/compose.go index 30992c4..3b47be9 100644 --- a/internal/constant/compose.go +++ b/internal/constant/compose.go @@ -20,5 +20,5 @@ package constant const ( Compose = "compose" - ComposeCommand = "docker-compose" + ComposeCommand = "docker compose" ) diff --git a/test/e2e/collect-expected.yaml b/test/e2e/collect-expected.yaml new file mode 100644 index 0000000..c99cbdf --- /dev/null +++ b/test/e2e/collect-expected.yaml @@ -0,0 +1,18 @@ +# Licensed to Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Apache Software Foundation (ASF) licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +collected: "true" diff --git a/test/e2e/e2e.yaml b/test/e2e/e2e.yaml index 23cb116..6bb2128 100644 --- a/test/e2e/e2e.yaml +++ b/test/e2e/e2e.yaml @@ -24,6 +24,17 @@ setup: cleanup: # always never success failure on: always + # Exercise the compose log collector in CI so a regression to Docker Compose v1 is + # caught: GitHub-hosted runners ship only Compose v2, so the collector must use + # `docker compose`. Auto-collect is off here; the verify case below invokes + # `e2e collect` explicitly and asserts a file was collected. + collect: + on: never + output-dir: /tmp/e2e-collect-check + items: + - service: httpbin + paths: + - /etc/hostname verify: # verify with retry strategy @@ -56,3 +67,13 @@ verify: query: './bin/linux/e2e verify -c ./test/e2e/concurrency/non-fail-fast/internal/verify.yaml --summary-only -o yaml' expected: ./concurrency/non-fail-fast/expected.yaml + # Guards the compose log collector against a regression to Docker Compose v1 + # (which is absent on GitHub-hosted runners). Runs `e2e collect` against the + # already-running compose stack and asserts a container file was collected. + - name: compose log collector works on Docker Compose v2 + query: | + rm -rf /tmp/e2e-collect-check + ./bin/linux/e2e collect -c ./test/e2e/e2e.yaml > /dev/null 2>&1 || true + if [ -s /tmp/e2e-collect-check/httpbin/etc/hostname ]; then echo 'collected: "true"'; else echo 'collected: "false"'; fi + expected: ./collect-expected.yaml +