Skip to content

Commit 0d0778f

Browse files
authored
Add smoke tests for IDVs and vehicles to production suite (#9)
1 parent f5a4722 commit 0d0778f

26 files changed

+7793
-210
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,5 @@ dmypy.json
146146
Thumbs.db
147147

148148
# other
149-
/yoni
149+
/yoni
150+
.cursor/*

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ markers = [
9797
"live: Tests that always use live API (skip cassettes)",
9898
"cached: Tests that only run with cached responses",
9999
"slow: Tests that are slow to execute",
100+
"production: Production API smoke tests that run against live API",
100101
]
101102

102103
[tool.coverage.run]

scripts/README.md

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,73 @@ This directory contains utility scripts used during development and maintenance
44

55
## Scripts
66

7+
### Schema and API Tools
8+
79
- **`fetch_api_schema.py`** - Fetches the OpenAPI schema from the Tango API and saves it locally
810
- **`generate_schemas_from_api.py`** - Generates schema definitions from the API reference (outputs to stdout)
911

12+
### Testing and Validation
13+
14+
- **`test_production.py`** - Runs production API smoke tests against the live API
15+
- **`pr_review.py`** - Runs configurable validation checks for PR review (linting, type checking, tests)
16+
1017
## Usage
1118

12-
These scripts are primarily for maintainers and are not part of the public API. They require:
13-
- `TANGO_API_KEY` environment variable
19+
These scripts are primarily for maintainers and are not part of the public API.
20+
21+
### Production API Testing
22+
23+
Run smoke tests against the production API:
24+
25+
```bash
26+
# Requires TANGO_API_KEY environment variable
27+
uv run python scripts/test_production.py
28+
```
29+
30+
This runs fast smoke tests (~30-60 seconds) that validate core SDK functionality against the live production API.
31+
32+
### PR Review Validation
33+
34+
Run validation checks for PR review. **Automatically detects PR context** from GitHub Actions, GitHub CLI, or git branch.
35+
36+
```bash
37+
# Auto-detect PR and run validation (default: production mode)
38+
uv run python scripts/pr_review.py
39+
40+
# Review a specific PR number
41+
uv run python scripts/pr_review.py --pr-number 123
42+
43+
# Smoke tests only
44+
uv run python scripts/pr_review.py --mode smoke
45+
46+
# Quick validation (linting + type checking, no tests)
47+
uv run python scripts/pr_review.py --mode quick
48+
49+
# Full validation (all checks including all tests)
50+
uv run python scripts/pr_review.py --mode full
51+
52+
# Check only changed files (auto-enabled when PR is detected)
53+
uv run python scripts/pr_review.py --mode production --changed-files-only
54+
```
55+
56+
**Validation Modes:**
57+
- `smoke` - Production API smoke tests only
58+
- `quick` - Linting + type checking (no tests)
59+
- `full` - All checks (linting + type checking + all tests)
60+
- `production` - Production API smoke tests + linting + type checking (default)
61+
62+
**PR Detection:**
63+
The script automatically detects PR information from:
64+
- GitHub Actions environment variables (`GITHUB_EVENT_PATH`, `GITHUB_PR_NUMBER`)
65+
- GitHub CLI (`gh pr view` - requires `gh auth login`)
66+
- Current git branch
67+
68+
When a PR is detected, the script displays PR information and automatically:
69+
- Detects the base branch from the PR
70+
- Checks only changed files
71+
- Shows PR URL in summary
72+
73+
## Requirements
74+
75+
- `TANGO_API_KEY` environment variable (required for production API tests)
76+
- All dependencies installed: `uv sync --all-extras`

0 commit comments

Comments
 (0)