|
| 1 | +# RERUM Fetch Timeout and Upstream Failure Test Cases |
| 2 | + |
| 3 | +This file documents test cases for TinyPen's outgoing RERUM fetch behavior. These are not executable tests, but serve as a checklist for future test harness development. |
| 4 | + |
| 5 | +## Expected Behaviors |
| 6 | + |
| 7 | +### 1. RERUM responds quickly (normal success path) |
| 8 | + |
| 9 | +- Setup: RERUM returns a valid 2xx JSON response before timeout |
| 10 | +- Should return expected route success code (200/201/204) |
| 11 | +- Response: pass-through body or headers expected by route |
| 12 | + |
| 13 | +### 2. RERUM accepts connection but never responds |
| 14 | + |
| 15 | +- Setup: upstream socket stays open with no response body/status |
| 16 | +- Should abort request after configured timeout |
| 17 | +- Should return 504 |
| 18 | +- Response: timeout message indicating RERUM did not respond in time |
| 19 | + |
| 20 | +### 3. RERUM response arrives just before timeout threshold |
| 21 | + |
| 22 | +- Setup: upstream responds slightly before timeout deadline |
| 23 | +- Should not abort request |
| 24 | +- Should return route success code and expected body |
| 25 | + |
| 26 | +### 4. RERUM network failure before response (DNS/connect/reset) |
| 27 | + |
| 28 | +- Setup: fetch fails with connection-level/network error |
| 29 | +- Should return 502 |
| 30 | +- Response: generic upstream error message |
| 31 | + |
| 32 | +### 5. RERUM returns non-2xx status with text body |
| 33 | + |
| 34 | +- Setup: upstream returns 4xx/5xx and text payload |
| 35 | +- Should return 502 from TinyPen routes |
| 36 | +- Response: includes upstream status and text body when available |
| 37 | + |
| 38 | +### 6. RERUM returns non-2xx status with unreadable/invalid body |
| 39 | + |
| 40 | +- Setup: upstream returns error status, body read fails |
| 41 | +- Should return 502 |
| 42 | +- Response: generic upstream error message |
| 43 | + |
| 44 | +### 7. RERUM returns 2xx with invalid payload shape for create/update/overwrite |
| 45 | + |
| 46 | +- Setup: upstream returns 200 but missing `id` and `@id` |
| 47 | +- Should return 502 |
| 48 | +- Response: generic upstream error message |
| 49 | + |
| 50 | +### 8. /overwrite conflict pass-through remains intact |
| 51 | + |
| 52 | +- Setup: upstream returns 409 with JSON conflict body |
| 53 | +- Should return 409 |
| 54 | +- Response: conflict JSON body from upstream |
| 55 | + |
| 56 | +### 9. Timeout value is overridden by environment variable |
| 57 | + |
| 58 | +- Setup: set `RERUM_FETCH_TIMEOUT_MS` to a small positive value |
| 59 | +- Should abort according to that configured value |
| 60 | +- Should return 504 on stalled upstream |
| 61 | + |
| 62 | +### 10. Invalid timeout env value falls back to default |
| 63 | + |
| 64 | +- Setup: set `RERUM_FETCH_TIMEOUT_MS` to empty, non-numeric, or <= 0 |
| 65 | +- Should use default timeout value |
| 66 | +- Should still abort stalled requests and return 504 |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +Add new cases as needed. Checklist for RERUM timeout and upstream resiliency behavior. |
0 commit comments