- Refactor download.go and stream.go with downloadDeps/streamDeps structs for dependency injection, enabling unit testing without real I/O - download_test.go: 15 tests — input validation, mock downloaders, method selection, cobra Args, deadlock detection - stream_test.go: input validation, noOpen flag, engine error handling - client_test.go: context cancellation, timeout, full Sync roundtrip, watch-progress and HTTP error unwrapping - sync_test.go: TriggerSync on watching transition, adjustInterval - torrent_test.go: TorrentDownloader lifecycle without network - stream_server_test.go: HTTP server lifecycle, SetFile/ClearFile, concurrent requests, Shutdown releases port, content-type - manager_integration_test.go: full pipeline — success, torrent→debrid fallback, all-fail, multi-concurrent, ForceStart, OnTaskDone, recent-finished drain, cancel mid-download, organize - usenet_test.go: Cancel/Pause race regression test (run with -race) - daemon_test.go: isAllowedStreamPath table tests - CI: split coverage gate to engine+agent only (50% threshold); cmd coverage still reported but not gated (interactive UI commands) - lefthook: add pre-push hook with go test -race -count=1 -timeout=120s
35 lines
861 B
YAML
35 lines
861 B
YAML
# Lefthook git hooks configuration
|
|
# Install: lefthook install (or make install-hooks)
|
|
# Docs: https://github.com/evilmartians/lefthook
|
|
|
|
pre-commit:
|
|
parallel: true
|
|
commands:
|
|
gofmt-check:
|
|
glob: "*.go"
|
|
run: test -z "$(gofmt -l .)" || { echo "Files not formatted:"; gofmt -l .; exit 1; }
|
|
go-vet:
|
|
glob: "*.go"
|
|
run: go vet ./...
|
|
go-build:
|
|
glob: "*.go"
|
|
run: go build ./...
|
|
golangci-lint:
|
|
glob: "*.go"
|
|
run: |
|
|
if command -v golangci-lint &> /dev/null; then
|
|
golangci-lint run ./...
|
|
else
|
|
echo "golangci-lint not installed, skipping (install: https://golangci-lint.run/welcome/install/)"
|
|
fi
|
|
|
|
pre-push:
|
|
commands:
|
|
go-test:
|
|
glob: "*.go"
|
|
run: go test -race -count=1 -timeout=120s ./...
|
|
|
|
commit-msg:
|
|
scripts:
|
|
validate.sh:
|
|
runner: bash
|