-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (54 loc) · 1.75 KB
/
Copy pathMakefile
File metadata and controls
65 lines (54 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.PHONY: test test-unit test-integration test-e2e test-all test-coverage docker-test-image build clean
# Run unit tests only (fast)
test-unit:
@echo "Running unit tests..."
go test -v -race ./... -short
# Run integration tests
test-integration:
@echo "Running integration tests..."
go test -v -race -tags=integration ./test/integration
# Run E2E tests
test-e2e:
@echo "Running E2E tests..."
go test -v -tags=e2e ./test/e2e
# Run all tests
test-all: test-unit test-integration test-e2e
@echo "All tests completed!"
# Run tests with coverage
test-coverage:
@echo "Running tests with coverage..."
go test -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Run specific test by name
# Usage: make test-one TEST=TestNormalizeKey
test-one:
go test -v -run $(TEST) ./...
# Build test Docker image
docker-test-image:
@echo "Building test Docker image..."
docker build -t bro-test-env:latest -f test/Dockerfile .
# Build the bro binary
build:
@echo "Building bro..."
go build -o bro ./cmd/bro
# Clean build artifacts and test files
clean:
@echo "Cleaning..."
rm -f bro
rm -f coverage.out coverage.html
go clean -testcache
# Default target
test: test-unit
# Help target
help:
@echo "Available targets:"
@echo " test-unit - Run unit tests (default)"
@echo " test-integration - Run integration tests"
@echo " test-e2e - Run E2E tests"
@echo " test-all - Run all tests"
@echo " test-coverage - Run tests with coverage report"
@echo " test-one TEST=name - Run specific test"
@echo " docker-test-image - Build Docker test environment"
@echo " build - Build the bro binary"
@echo " clean - Clean build artifacts"