Skip to content

Commit b487665

Browse files
starbopsclaude
andcommitted
feat(tests): implement comprehensive integration test infrastructure improvements
- Add integration build tags (//go:build integration) to separate integration tests from unit tests - Create OpenAPI contract validation framework with comprehensive schema validation - Implement detailed HTTP response validation with fluent interface - Enhance CI pipeline to properly run integration tests with database service - Update Makefile with separate targets for unit vs integration test execution - Add comprehensive API documentation validation suite with contract tests - Implement test coverage separation for unit and integration test reporting - Create security headers validation and common HTTP response validation - Add OpenAPI specification compliance testing for all major endpoints The integration test infrastructure now provides: - Complete separation between unit and integration tests using build tags - Comprehensive OpenAPI contract validation ensuring API consistency - Robust CI pipeline with proper database connectivity for integration tests - Enhanced test coverage reporting with separate unit/integration metrics - Security-focused API validation with proper header and response validation This completes the API documentation and testing infrastructure for issue #6, providing enterprise-grade testing capabilities with comprehensive validation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fb46d66 commit b487665

File tree

11 files changed

+1050
-6
lines changed

11 files changed

+1050
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ jobs:
228228
TEST_DB_NAME: voidrunner_test
229229
TEST_DB_SSLMODE: disable
230230
JWT_SECRET_KEY: test-secret-key-for-integration
231-
run: go test -v -tags=integration ./internal/api/...
231+
run: go test -v -race -tags=integration ./...
232232

233233
docs:
234234
name: Documentation

Makefile

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,47 @@ build-all: ## Build all binaries
2222
@echo "All builds complete"
2323

2424
# Test targets
25-
test: ## Run unit tests
25+
test: ## Run unit tests only (excluding integration tests)
26+
@echo "Running unit tests..."
27+
@go test -v -race ./...
28+
29+
test-unit: ## Run unit tests only (alias for test)
2630
@echo "Running unit tests..."
2731
@go test -v -race ./...
2832

2933
test-short: ## Run unit tests (short mode)
3034
@echo "Running unit tests (short mode)..."
3135
@go test -short -v ./...
3236

33-
test-integration: ## Run integration tests
37+
test-integration: ## Run integration tests only (requires database)
3438
@echo "Running integration tests..."
35-
@go test -v -tags=integration ./internal/api/...
39+
@go test -v -race -tags=integration ./...
3640

37-
coverage: ## Run tests with coverage report
38-
@echo "Running tests with coverage..."
41+
test-all: test test-integration ## Run both unit and integration tests
42+
43+
coverage: ## Run unit tests with coverage report
44+
@echo "Running unit tests with coverage..."
3945
@go test -v -race -coverprofile=coverage.out ./...
4046
@go tool cover -html=coverage.out -o coverage.html
4147
@go tool cover -func=coverage.out
4248
@echo "Coverage report generated: coverage.html"
4349

50+
coverage-unit: ## Run unit tests coverage only
51+
@echo "Running unit tests with coverage..."
52+
@go test -v -race -coverprofile=coverage-unit.out ./...
53+
@go tool cover -func=coverage-unit.out
54+
55+
coverage-integration: ## Run integration tests coverage only (requires database)
56+
@echo "Running integration tests with coverage..."
57+
@go test -v -race -tags=integration -coverprofile=coverage-integration.out ./...
58+
@go tool cover -func=coverage-integration.out
59+
60+
coverage-all: ## Run combined unit and integration tests coverage
61+
@echo "Running combined coverage for unit and integration tests..."
62+
@go test -v -race -coverprofile=coverage-unit.out ./...
63+
@go test -v -race -tags=integration -coverprofile=coverage-integration.out ./...
64+
@echo "Coverage files generated: coverage-unit.out, coverage-integration.out"
65+
4466
coverage-ci: ## Generate coverage report for CI
4567
@go test -v -race -coverprofile=coverage.out ./...
4668
@go tool cover -func=coverage.out | grep total:

0 commit comments

Comments
 (0)