Files
dnswatcher/Makefile
user a2819c34d9
All checks were successful
Check / check (pull_request) Successful in 10m9s
fix: skip real-DNS resolver tests in make check, add timeout
Resolver tests perform iterative DNS resolution from root nameservers,
which can hang indefinitely. This broke make check on main.

Changes:
- Add -short and -timeout 30s flags to go test in make check
- Skip real-DNS integration tests when -short is set (via testContext helper)
- Context-canceled tests still run (no network needed)
- Also add -timeout 30s to make test target

Run integration tests explicitly with: go test -v -race ./internal/resolver/...
2026-02-21 02:37:38 -08:00

38 lines
1020 B
Makefile

.PHONY: all build lint fmt test check clean
BINARY := dnswatcher
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILDARCH := $(shell go env GOARCH)
LDFLAGS := -X main.Version=$(VERSION) -X main.Buildarch=$(BUILDARCH)
all: check build
build:
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/dnswatcher
lint:
golangci-lint run --config .golangci.yml ./...
fmt:
gofmt -s -w .
goimports -w .
test:
go test -v -race -cover -timeout 30s ./...
# Check runs all validation without making changes
# Used by CI and Docker build - fails if anything is wrong
check:
@echo "==> Checking formatting..."
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1)
@echo "==> Running linter..."
golangci-lint run --config .golangci.yml ./...
@echo "==> Running tests..."
go test -v -race -short -timeout 30s ./...
@echo "==> Building..."
go build -ldflags "$(LDFLAGS)" -o /dev/null ./cmd/dnswatcher
@echo "==> All checks passed!"
clean:
rm -rf bin/