AlexsLemonade / AlexsLemonade/refinebio

API tests sometimes fail because we don't trigger a 429

Open
#2,791 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
135
Forks
21
PR merge metrics
No merged PRs in 30d

Description

### Context

The failing test looks like:

```
FAIL: test_all_endpoints (data_refinery_api.test.test_api_general.APITestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/user/data_refinery_api/test/test_api_general.py", line 339, in test_all_endpoints
self.assertEqual(response.status_code, status.HTTP_429_TOO_MANY_REQUESTS)
AssertionError: 200 != 429
```

### Problem or idea

It only happens every now and then. I suspect we're relying too carefully on timing and it sometimes doesn't work out. It makes sense since the test is about rate limiting requests.

### Solution or next step

Make the test more reliable.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in test/test_api_general.py at test_all_endpoints, around line 339, and inspect how the rate-limit request sequence produces the expected 429 response. Make the test reliably assert 429 instead of intermittently receiving 200, then rerun the API tests to confirm the failure no longer depends on timing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.