Skip to content

Commit 7e7294e

Browse files
Sebastiancrivetimihai
authored andcommitted
Add new Makefile targets
Signed-off-by: Sebastian <[email protected]>
1 parent 6a43a86 commit 7e7294e

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

Makefile

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3705,6 +3705,97 @@ pip-audit: ## 🔒 Audit Python dependencies for CVEs
37053705
python3 -m pip install --quiet --upgrade pip-audit && \
37063706
pip-audit --strict || true"
37073707

3708+
3709+
3710+
## --------------------------------------------------------------------------- ##
3711+
## Async Code Testing and Performance Profiling
3712+
## --------------------------------------------------------------------------- ##
3713+
.PHONY: async-test async-lint profile async-monitor async-debug profile-serve
3714+
3715+
ASYNC_TEST_DIR := async_testing
3716+
PROFILE_DIR := $(ASYNC_TEST_DIR)/profiles
3717+
REPORTS_DIR := $(ASYNC_TEST_DIR)/reports
3718+
VENV_PYTHON := $(VENV_DIR)/bin/python
3719+
3720+
async-test: async-lint async-debug
3721+
@echo "🔄 Running comprehensive async safety tests..."
3722+
@mkdir -p $(REPORTS_DIR)
3723+
@PYTHONASYNCIODEBUG=1 $(VENV_PYTHON) -m pytest \
3724+
tests/ \
3725+
--asyncio-mode=auto \
3726+
--tb=short \
3727+
--junitxml=$(REPORTS_DIR)/async-test-results.xml \
3728+
-v
3729+
3730+
async-lint:
3731+
@echo "🔍 Running async-aware linting..."
3732+
@$(VENV_DIR)/bin/ruff check mcpgateway/ tests/ \
3733+
--select=F,E,B,ASYNC \
3734+
--output-format=github
3735+
@$(VENV_DIR)/bin/flake8 mcpgateway/ tests/ \
3736+
--extend-select=B,ASYNC \
3737+
--max-line-length=100
3738+
@$(VENV_DIR)/bin/mypy mcpgateway/ \
3739+
--warn-unused-coroutine \
3740+
--strict
3741+
3742+
profile:
3743+
@echo "📊 Generating async performance profiles..."
3744+
@mkdir -p $(PROFILE_DIR)
3745+
@$(VENV_PYTHON) $(ASYNC_TEST_DIR)/profiler.py \
3746+
--scenarios websocket,database,mcp_calls \
3747+
--output $(PROFILE_DIR) \
3748+
--duration 60
3749+
@echo "🌐 Starting SnakeViz server..."
3750+
@$(VENV_DIR)/bin/snakeviz $(PROFILE_DIR)/combined_profile.prof \
3751+
--server --port 8080
3752+
3753+
profile-serve:
3754+
@echo "🌐 Starting SnakeViz profile server..."
3755+
@$(VENV_DIR)/bin/snakeviz $(PROFILE_DIR) \
3756+
--server --port 8080 --hostname 0.0.0.0
3757+
3758+
async-monitor:
3759+
@echo "👁️ Starting aiomonitor for live async debugging..."
3760+
@$(VENV_PYTHON) $(ASYNC_TEST_DIR)/monitor_runner.py \
3761+
--webui_port 50101 \
3762+
--console_port 50102 \
3763+
--host localhost \
3764+
--console-enabled
3765+
3766+
async-debug:
3767+
@echo "🐛 Running async tests with debug mode..."
3768+
@PYTHONASYNCIODEBUG=1 $(VENV_PYTHON) -X dev \
3769+
-m pytest tests/ \
3770+
--asyncio-mode=auto \
3771+
--capture=no \
3772+
-v
3773+
3774+
async-benchmark:
3775+
@echo "⚡ Running async performance benchmarks..."
3776+
@$(VENV_PYTHON) $(ASYNC_TEST_DIR)/benchmarks.py \
3777+
--output $(REPORTS_DIR)/benchmark-results.json \
3778+
--iterations 1000
3779+
3780+
profile-compare:
3781+
@echo "📈 Comparing performance profiles..."
3782+
@$(VENV_PYTHON) $(ASYNC_TEST_DIR)/profile_compare.py \
3783+
--baseline $(PROFILE_DIR)/combined_profile.prof \
3784+
--current $(PROFILE_DIR)/mcp_calls_profile.prof \
3785+
--output $(REPORTS_DIR)/profile-comparison.json
3786+
3787+
async-validate:
3788+
@echo "✅ Validating async code patterns..."
3789+
@$(VENV_PYTHON) $(ASYNC_TEST_DIR)/async_validator.py \
3790+
--source mcpgateway/ \
3791+
--report $(REPORTS_DIR)/async-validation.json
3792+
3793+
async-clean:
3794+
@echo "🧹 Cleaning async testing artifacts..."
3795+
@rm -rf $(PROFILE_DIR)/* $(REPORTS_DIR)/*
3796+
@pkill -f "aiomonitor" || true
3797+
@pkill -f "snakeviz" || true
3798+
37083799
## --------------------------------------------------------------------------- ##
37093800
## Gitleaks (Go binary - separate installation)
37103801
## --------------------------------------------------------------------------- ##

0 commit comments

Comments
 (0)