-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
priority: criticalMust be fixed immediatelyMust be fixed immediatelyquadrant: q1Urgent & Important (Do First)Urgent & Important (Do First)technical-debtTechnical debt that should be addressedTechnical debt that should be addressedtype: testingTesting infrastructure and test suitesTesting infrastructure and test suites
Description
Problem
We shipped SDK v1.4.1 with 100% timeout rate on historical queries. Unit tests passed because they used mocked responses.
Root Cause: No integration tests calling real API endpoints
Impact
- Severity: P0 - 100% failure rate for core feature
- Detection: Customer report (not CI/CD)
- Time to fix: 2 hours emergency fix
- Could have been: Hundreds of users affected
Solution
Add integration test suite that calls real production API:
# tests/integration/test_real_api_historical.py
@pytest.mark.integration
def test_1_year_query_against_production():
"""Test real 1-year historical query."""
client = OilPriceAPI(api_key=os.getenv('TEST_API_KEY'))
start_time = time.time()
historical = client.historical.get(
commodity='WTI_USD',
start_date='2024-01-01',
end_date='2024-12-31',
interval='daily'
)
duration = time.time() - start_time
# Would have caught the timeout bug
assert duration < 120, f"Query took {duration}s, exceeds timeout"
assert len(historical.data) > 300Test Cases to Add
-
Endpoint existence tests
- Verify all 4 historical endpoints exist (past_day, past_week, past_month, past_year)
- Verify they return expected data format
-
Query completion tests
- 1 day query completes successfully
- 1 week query completes successfully
- 1 month query completes successfully
- 1 year query completes successfully
-
Timeout behavior tests
- Queries complete within calculated timeout
- TimeoutError raised if query exceeds timeout
-
Data validation tests
- Correct number of records returned
- Data format matches expectations
- Pagination works correctly
Implementation
# New directory structure
tests/
integration/
__init__.py
conftest.py # Shared fixtures
test_historical.py # Historical endpoint tests
test_prices.py # Current price tests
test_alerts.py # Alert endpoint testsCI Integration
# .github/workflows/test.yml
jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run integration tests
env:
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
run: |
pytest tests/integration/ --integration -vAcceptance Criteria
- Integration test suite created in
tests/integration/ - Tests cover all historical endpoints
- Tests validate timeout behavior
- Tests run in CI before every release
- Test API key configured in GitHub Secrets
- Tests pass consistently
Estimated Effort
Time: 2-3 hours
Complexity: Low (straightforward API calls)
Blocker: Need test API key with Production Boost access
Success Metrics
- Integration tests catch issues that unit tests miss
- Zero P0 bugs ship to production due to SDK issues
- Confidence in releases increases
Related Issues
- Historical timeout bug (idan@comity.ai)
- QA Assessment: sdks/python/QA_ASSESSMENT_HISTORICAL_TIMEOUT_ISSUE.md
Notes
This would have caught the historical timeout bug in CI before it reached customers. Must be completed before next SDK release.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: criticalMust be fixed immediatelyMust be fixed immediatelyquadrant: q1Urgent & Important (Do First)Urgent & Important (Do First)technical-debtTechnical debt that should be addressedTechnical debt that should be addressedtype: testingTesting infrastructure and test suitesTesting infrastructure and test suites