Skip to content

Commit 86813e3

Browse files
test: create separate target for e2e tests
1 parent cc99550 commit 86813e3

File tree

1 file changed

+30
-17
lines changed

1 file changed

+30
-17
lines changed

Makefile

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,43 @@ deps:
4545
go mod verify
4646
@echo "✓ Dependencies ready!"
4747

48-
# Run tests (needs sudo for E2E tests)
49-
.PHONY: test
50-
test:
51-
@echo "Running tests..."
48+
# Run unit tests only (no sudo required)
49+
.PHONY: unit-test
50+
unit-test:
51+
@echo "Running unit tests..."
5252
@which go > /dev/null || (echo "Go not found in PATH" && exit 1)
53-
sudo $(shell which go) test -v -race ./...
54-
@echo "All tests passed!"
53+
go test -v -race ./proxy ./tls ./rules ./audit ./cli
54+
@echo "Unit tests passed!"
5555

56-
# Run tests with coverage (needs sudo for E2E tests)
57-
.PHONY: test-coverage
58-
test-coverage:
59-
@echo "Running tests with coverage..."
56+
# Run E2E tests (Linux only, needs sudo)
57+
.PHONY: e2e-test
58+
e2e-test:
59+
@echo "Running E2E tests..."
6060
@which go > /dev/null || (echo "Go not found in PATH" && exit 1)
61-
sudo $(shell which go) test -v -race -coverprofile=coverage.out ./...
61+
@if [ "$$(uname)" != "Linux" ]; then \
62+
echo "E2E tests require Linux platform. Current platform: $$(uname)"; \
63+
exit 1; \
64+
fi
65+
sudo $(shell which go) test -v -race ./e2e_tests
66+
@echo "✓ E2E tests passed!"
67+
68+
# Run unit tests with coverage
69+
.PHONY: unit-test-coverage
70+
unit-test-coverage:
71+
@echo "Running unit tests with coverage..."
72+
@which go > /dev/null || (echo "Go not found in PATH" && exit 1)
73+
go test -v -race -coverprofile=coverage.out ./proxy ./tls ./rules ./audit ./cli
6274
$(shell which go) tool cover -html=coverage.out -o coverage.html
63-
@echo "Coverage report generated: coverage.html"
75+
@echo "Unit test coverage report generated: coverage.html"
6476

65-
# CI checks (deps, test, build)
77+
# CI checks (deps, unit-test, e2e-test, build)
6678
.PHONY: ci
67-
ci: deps test build
79+
ci: deps unit-test e2e-test build
6880
@echo "✓ All CI checks passed!"
6981

7082
# CI checks with coverage
7183
.PHONY: ci-coverage
72-
ci-coverage: deps test-coverage build
84+
ci-coverage: deps unit-test-coverage e2e-test build
7385
@echo "✓ All CI checks with coverage passed!"
7486

7587
# Prepare release archives
@@ -143,8 +155,9 @@ help:
143155
@echo " build Build for current platform"
144156
@echo " build-all Build for all supported platforms"
145157
@echo " deps Download and verify dependencies"
146-
@echo " test Run tests"
147-
@echo " test-coverage Run tests with coverage report"
158+
@echo " unit-test Run unit tests only (no sudo required)"
159+
@echo " e2e-test Run E2E tests (Linux only, needs sudo)"
160+
@echo " unit-test-coverage Run unit tests with coverage"
148161
@echo " ci Run CI checks (deps + test + build)"
149162
@echo " ci-coverage Run CI checks with coverage"
150163
@echo " release-archives Create release archives"

0 commit comments

Comments
 (0)