Skip to content

Testing

Unit tests

make test
# or
go test -v -race -coverprofile=coverage.out ./...

Tests run with the race detector and write a coverage profile. Domain, config, and adapter logic carry table-driven tests (e.g. scantasks, repocfg, crapreport, result_store, repo_config_store).

End-to-end tests

The repocache package has a gated end-to-end test that exercises the real adapters: Postgres lock store, on-disk git clone, real go test -coverprofile, and a real go-crap scan.

# requires a reachable Postgres (GCT_E2E_DSN) and the go-crap binary
go test -tags e2e ./internal/adapters/secondary/repocache/

The e2e build tag keeps this out of the default go test ./... run.

Coverage

go test -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out   # browser view

Or make test-coverage.

Lint & format

make fmt    # go fmt ./...
make lint   # golangci-lint run ./...

A quick sanity check

go vet ./...