Build/test fixes
This commit is contained in:
22
Makefile
22
Makefile
@@ -1,4 +1,4 @@
|
||||
.PHONY: all build test lint coverage clean install help docker-up docker-down docker-test docker-test-integration
|
||||
.PHONY: all build test test-unit test-integration lint coverage clean install help docker-up docker-down docker-test docker-test-integration
|
||||
|
||||
# Binary name
|
||||
BINARY_NAME=relspec
|
||||
@@ -22,9 +22,23 @@ build: ## Build the binary
|
||||
$(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/relspec
|
||||
@echo "Build complete: $(BUILD_DIR)/$(BINARY_NAME)"
|
||||
|
||||
test: ## Run tests
|
||||
@echo "Running tests..."
|
||||
$(GOTEST) -v -race -coverprofile=coverage.out ./...
|
||||
test: test-unit ## Run all unit tests (alias for test-unit)
|
||||
|
||||
test-unit: ## Run unit tests (excludes integration tests)
|
||||
@echo "Running unit tests..."
|
||||
$(GOTEST) -v -race -coverprofile=coverage.out -covermode=atomic $$(go list ./... | grep -v '/tests/integration' | grep -v '/pkg/readers/pgsql')
|
||||
|
||||
test-integration: ## Run integration tests (requires RELSPEC_TEST_PG_CONN environment variable)
|
||||
@echo "Running integration tests..."
|
||||
@if [ -z "$$RELSPEC_TEST_PG_CONN" ]; then \
|
||||
echo "Error: RELSPEC_TEST_PG_CONN environment variable is not set"; \
|
||||
echo "Example: export RELSPEC_TEST_PG_CONN='postgres://relspec:relspec_test_password@localhost:5432/relspec_test'"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "Running PostgreSQL reader tests..."
|
||||
$(GOTEST) -v -count=1 ./pkg/readers/pgsql/
|
||||
@echo "Running general integration tests..."
|
||||
$(GOTEST) -v -count=1 ./tests/integration/
|
||||
|
||||
coverage: test ## Run tests with coverage report
|
||||
@echo "Generating coverage report..."
|
||||
|
||||
Reference in New Issue
Block a user