-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (77 loc) · 3.65 KB
/
Makefile
File metadata and controls
95 lines (77 loc) · 3.65 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.PHONY: lint-check lint-fix format-check format-fix type-check run-checks deps install tests uninstall clean release setup-db teardown-db reset-db status-db test-connection
lint-check:
uv run ruff check
lint-fix:
uv run ruff check --fix
format-check:
uv run ruff format --check
format-fix:
uv run ruff format
type-check:
uv run pyrefly check
run-checks: lint-check format-check
deps:
uv sync --locked --all-extras --dev
install: deps
uv pip install -e .
tests:
uv run pytest
test-http-live: ## Run HTTP tests with specific server URL
@echo "Usage: make test-http-live SERVER_URL=http://localhost:8080 BASE_PATH=/api/v1 API_KEY=your-key"
@if [ -z "$(SERVER_URL)" ]; then echo "ERROR: SERVER_URL is required"; exit 1; fi
uv run pytest tests/test_real_server.py tests/test_real_server_async.py \
--use-real-server \
--server-url="$(SERVER_URL)" \
$(if $(BASE_PATH),--base-path="$(BASE_PATH)") \
$(if $(API_KEY),--api-key="$(API_KEY)") \
-xvs
uninstall:
uv pip uninstall .
clean: ## Clean up generated files and environment
uv pip uninstall .
uv clean
rm -rf .venv .ruff_cache .pytest_cache
rm -rf **/*/*.egg-info **/*/__pycache__
rm -rf .coverage htmlcov/ .pytest_cache/ .mypy_cache/ __pycache__/ .ruff_cache/
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
release:
uv run scripts/release.py
setup-db: ## Start SingleStore database
@echo "🚀 Starting SingleStore database..."
@docker compose -f tests/compose-singlestore.yml down -v >/dev/null 2>&1 || true
@docker compose -f tests/compose-singlestore.yml up -d >/dev/null 2>&1
@echo "⏳ Waiting for database to be ready..."
@timeout 30 bash -c 'i=0; until docker compose -f tests/compose-singlestore.yml ps | grep -q "healthy"; do i=$$((i+3)); echo "⏳ Still waiting for database... ($$i/30s)"; sleep 3; done; echo "✅ Database is ready!"' || (echo "❌ Database failed to start within 30 seconds"; exit 1)
@echo "📝 Initializing database schema..."
@docker compose -f tests/compose-singlestore.yml exec -T singlestore-test singlestore -u root -ptest < tests/init.sql >/dev/null 2>&1 && echo "✅ Schema initialized successfully"
@echo "✅ Database ready and initialized"
@echo " • Port: 33071"
@echo " • Web UI: http://localhost:18091"
@echo " • Test databases:"
@docker compose -f tests/compose-singlestore.yml exec -T singlestore-test singlestore -u root -ptest -e "SHOW DATABASES;" 2>/dev/null | grep -E "test" | sed 's/^/ /'
teardown-db: ## Stop SingleStore database
@echo "🛑 Stopping SingleStore database..."
@docker compose -f tests/compose-singlestore.yml down -v >/dev/null 2>&1
@echo "✅ Database stopped"
reset-db: teardown-db setup-db ## Reset SingleStore database (stop and start fresh)
status-db: ## Check SingleStore database status
@echo "🔍 Checking database status..."
@if docker compose -f tests/compose-singlestore.yml ps | grep -q "singlestore-test.*Up"; then \
echo "✅ SingleStore database is running"; \
echo " • Port: 33071"; \
echo " • Web UI: http://localhost:18091"; \
echo " • Management: http://localhost:19191"; \
else \
echo "❌ SingleStore database is not running"; \
echo " Run 'make setup-db' to start it"; \
fi
test-connection: ## Test connection from host using custom port
@echo "🔍 Testing database connection..."
@echo "⏳ Attempting to connect..."
@if docker compose -f tests/compose-singlestore.yml exec -T singlestore-test singlestore -u root -ptest -e "SHOW DATABASES;" >/dev/null 2>&1; then \
echo "✅ Connection successful - database is responding"; \
else \
echo "❌ Connection failed - ensure SingleStore is running"; \
echo " Try: make setup-db"; \
fi