test: skip container-backed integration tests under -short#1
Conversation
The qdrant_test suite spins up Qdrant via testcontainers-go. On any host
without a reachable Docker daemon (dev workstations running `go test`,
lint-only CI lanes that don't provision Docker, pre-commit hooks, etc.)
this used to panic at `MustExtractDockerHost`:
panic: rootless Docker not found
.../testcontainers-go/internal/core/docker_host.go:91
making it impossible to run `go test ./...` outside the CI Docker path.
Gate each container-backed entrypoint on `testing.Short()`:
- TestCollectionsClient
- TestPointsClient
- TestSnapshotsClient
- TestHealthCheck
Pure-unit tests (TestParseVersion, TestIsCompatible) are untouched and
still run under `-short`. The normal `go test ./...` path and CI's
`Go Tests` workflow are unchanged because they don't pass `-short`.
Shared `skipIfShort(t)` helper lives in image_test.go alongside the
container factories it pairs with.
Verified:
- `go test -short ./...` → all packages PASS (previously: panic)
- `go test -run TestIsCompatible ./qdrant_test/...` → PASS
- `go build ./... && go vet ./...` → clean
— kcolbchain / Abhishek Krishna
|
Heads up on the two red checks on this PR — both are pre-existing on master, not introduced by this diff: 1.
2.
The That's a separate, much larger problem (need either a ZAP-aware Qdrant server image or a shim). Out of scope for this PR, flagging for visibility. Happy to dig into it as a follow-up if there's appetite. The contribution of this PR: a dev trying to run |
This PR adds skipIfShort guards to qdrant_test/* so the container-backed
integration tests opt out under -short, but the workflow still ran
`go test -v ./...` without -short — every Qdrant client test failed
because no Qdrant service is provisioned on the runner ("response
payload too large", "unexpected EOF").
Pass -short on the unit-test job; an integration job that boots Qdrant
as a service container can be added later and will run without -short.
What
Gate the four Qdrant-container-backed tests on
testing.Short():TestCollectionsClient(qdrant_test/collections_test.go)TestPointsClient(qdrant_test/points_test.go)TestSnapshotsClient(qdrant_test/snapshots_test.go)TestHealthCheck(qdrant_test/qdrant_test.go)Pure-unit tests (
TestParseVersion,TestIsCompatible) are untouched — they already run fine everywhere.A small shared helper
skipIfShort(t)lives alongside the container factories inimage_test.go.Why
Every container-backed entrypoint calls
testcontainers.GenericContainer(...), which in turn callstestcontainers-go/internal/core.MustExtractDockerHost. On any host without a reachable Docker daemon, that function panics:Reproduction on a dev workstation without Docker:
This makes
go test ./...unusable for contributors who are iterating on non-integration code paths (compare_versions, value_map, oneof_factory, etc.) — you either install & start Docker or you can't run the suite at all.After this patch:
The normal
go test ./...path is unchanged, so CI'sGo Testsworkflow (which doesn't pass-short) keeps running the full integration suite exactly as before. The-shortflag is only opt-in.Verified
go test -short ./...→ all packages PASS (previously: panic)go test -run TestIsCompatible ./qdrant_test/...→ PASS (confirms pure-unit tests unaffected)go build ./...→ cleango vet ./...→ cleangofmt -l qdrant_test/→ clean on modified filesScope
Pure
test:change — no production code inqdrant/touched. No dependency changes. No workflow changes.— kcolbchain / Abhishek Krishna