test(e2e): gate the e2e suite behind the build tag the docs already promise

AGENTS.md documents 'Test unit: go test ./pkg/...' and 'E2E tests:
go test -tags e2e ./pkg/e2e/'. Both statements were false: no file in
pkg/e2e carried an e2e build constraint, so the -tags flag was a no-op
and the 'unit' command actually launched the full e2e suite — requiring
a Docker daemon and the locally built binary, creating and destroying
containers, for up to 20 minutes. CI only avoided this by grepping e2e
out of the package list (Dockerfile).

Every *_test.go in pkg/e2e now carries //go:build e2e (merged with the
existing !windows constraints), and the Makefile e2e targets pass the
tag. The documented commands become true:
- go test ./pkg/...          -> pkg/e2e reports [no test files]
- go test -tags e2e ./pkg/e2e -> runs the suite

AGENTS.md now also states the daemon/binary prerequisites explicitly.

Part of #14074 (A: the code misdescribes its own structure).

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2026-08-17 14:13:47 +02:00 committed by Guillaume Lours
parent 7b63e4fa33
commit 7af58e3626
51 changed files with 98 additions and 10 deletions

View file

@ -4,9 +4,11 @@
- Build: `make build`
- Test all: `make test`
- Test unit: `go test ./pkg/...`
- Test unit: `go test ./pkg/...` — needs no Docker daemon; the e2e suite is
gated behind the `e2e` build tag and is not picked up
- Test single: `go test ./pkg/compose/ -run TestFunctionName`
- E2E tests: `go test -tags e2e ./pkg/e2e/ -run TestName`
- E2E tests: `go test -tags e2e ./pkg/e2e/ -run TestName` — requires a Docker
daemon and the locally built binary (`make build`)
## E2E tests

View file

@ -77,11 +77,11 @@ install: binary
.PHONY: e2e-compose
e2e-compose: example-provider ## Run end to end local tests in plugin mode. Set E2E_TEST=TestName to run a single test
go run gotest.tools/gotestsum@latest --format testname --junitfile "/tmp/report/report.xml" -- -v $(TEST_FLAGS) -count=1 -parallel=$(E2E_PARALLEL_PLUGIN) -timeout 20m ./pkg/e2e
go run gotest.tools/gotestsum@latest --format testname --junitfile "/tmp/report/report.xml" -- -v $(TEST_FLAGS) -count=1 -parallel=$(E2E_PARALLEL_PLUGIN) -timeout 20m -tags e2e ./pkg/e2e
.PHONY: e2e-compose-standalone
e2e-compose-standalone: ## Run End to end local tests in standalone mode. Set E2E_TEST=TestName to run a single test
go run gotest.tools/gotestsum@latest --format testname --junitfile "/tmp/report/report.xml" -- $(TEST_FLAGS) -v -count=1 -parallel=$(E2E_STANDALONE_PARALLEL) -timeout 20m --tags=standalone ./pkg/e2e
go run gotest.tools/gotestsum@latest --format testname --junitfile "/tmp/report/report.xml" -- $(TEST_FLAGS) -v -count=1 -parallel=$(E2E_STANDALONE_PARALLEL) -timeout 20m --tags=e2e,standalone ./pkg/e2e
.PHONY: build-and-e2e-compose
build-and-e2e-compose: build e2e-compose ## Compile the compose cli-plugin and run end to end local tests in plugin mode. Set E2E_TEST=TestName to run a single test

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,4 +1,4 @@
//go:build !windows
//go:build e2e && !windows
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,4 +1,4 @@
//go:build !windows
//go:build e2e && !windows
/*
Copyright 2022 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2023 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,4 +1,4 @@
//go:build !windows
//go:build e2e && !windows
/*
Copyright 2022 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2023 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2023 Docker Compose CLI authors

View file

@ -1,4 +1,4 @@
//go:build !windows
//go:build e2e && !windows
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2023 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2023 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2026 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2026 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2026 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,4 +1,4 @@
//go:build !windows
//go:build e2e && !windows
/*
Copyright 2022 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2022 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,4 +1,4 @@
//go:build !windows
//go:build e2e && !windows
/*
Copyright 2022 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2020 Docker Compose CLI authors

View file

@ -1,3 +1,5 @@
//go:build e2e
/*
Copyright 2023 Docker Compose CLI authors