Skip to content

Commit ce4c62b

Browse files
committed
Add production API smoke tests and PR review validation
- Add production test suite with smoke tests against live API - Add test_production.py script for running production smoke tests - Add pr_review.py script for PR validation (smoke, quick, full, production modes) - Add production test marker to pytest configuration - Update integration tests with cursor pagination support - Add VCR cassettes for production and integration tests - Update scripts README with documentation for new scripts - Update .gitignore to exclude .cursor directory - Minor improvements to client and models for test compatibility
1 parent 8745189 commit ce4c62b

14 files changed

Lines changed: 1277 additions & 30 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,5 @@ dmypy.json
144144
# OS
145145
.DS_Store
146146
Thumbs.db
147+
148+
.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)