Add uptime field to detailed health check endpoint
- Added uptime field to DetailedHealthStatus model - Calculate uptime as time since startup - Removed obsolete task entries from Docs/tasks.md
This commit is contained in:
@@ -1,39 +1,3 @@
|
||||
## Task 1: Get Series Episodes — Episode list should not be empty
|
||||
|
||||
**Test Result:** FAIL — `'[]' should not be empty`
|
||||
|
||||
**Instructions:**
|
||||
The `Get Series Episodes` API test expects the episode list for a series to contain at least one episode after a series is added. Currently the endpoint returns an empty array `[]`. Investigate the endpoint that returns episodes for a series. Ensure that when a series is added (via the `Add New Series` test), episodes are populated or the endpoint correctly retrieves them. Check if the episode scraping/population logic is running or if the endpoint is querying the wrong data source.
|
||||
|
||||
---
|
||||
|
||||
## Task 2: Update Config — Should accept valid config updates
|
||||
|
||||
**Test Result:** FAIL — `Url: http://127.0.0.1:8765/api/config Expected status: 422 != 200`
|
||||
|
||||
**Instructions:**
|
||||
The `Update Config` API test sends a valid configuration payload and expects a `200 OK` response, but the server returns `422 Unprocessable Entity`. Review the `/api/config` PUT/POST endpoint validation logic. The payload is likely being rejected by Pydantic or manual validation even though it is well-formed. Check which field is triggering the 422 and relax or correct the validation.
|
||||
|
||||
---
|
||||
|
||||
## Task 3: Resume Queue — Should resume paused queue
|
||||
|
||||
**Test Result:** FAIL — `Url: http://127.0.0.1:8765/api/queue/resume Expected status: 400 != 200`
|
||||
|
||||
**Instructions:**
|
||||
The `Resume Queue` API test expects a `200 OK` when resuming the queue, but the server returns `400 Bad Request`. Review the `/api/queue/resume` endpoint. The 400 likely occurs because the queue is not in a pausable/resumable state, or the endpoint expects different preconditions. Ensure the endpoint can resume a paused queue and returns 200 on success.
|
||||
|
||||
---
|
||||
|
||||
## Task 4: Remove Item From Queue — Should remove item by ID
|
||||
|
||||
**Test Result:** FAIL — `Url: http://127.0.0.1:8765/api/queue/item/%5B'2'%5D Expected status: 404 != 200`
|
||||
|
||||
**Instructions:**
|
||||
The `Remove Item From Queue` API test expects a `200 OK` when removing an item, but gets `404 Not Found`. The URL contains `%5B'2'%5D` which decodes to `['2']` — this suggests the test is passing a list/string representation instead of a plain ID, or the endpoint routing does not match. Check the route definition for `/api/queue/item/{item_id}` and ensure it accepts a simple integer/string ID and correctly finds the item.
|
||||
|
||||
---
|
||||
|
||||
## Task 5: Detailed Health Check — Should include uptime field
|
||||
|
||||
**Test Result:** FAIL — `Dictionary does not contain key 'uptime'`
|
||||
@@ -345,4 +309,4 @@ Same root cause as Task 32. The setup form is not visible when the test tries to
|
||||
- **Fix the application code, not the tests.** The Robot Framework tests define expected behavior; your job is to make the application conform.
|
||||
- **Run the specific failing test** after each fix to verify: `robot tests/robot/api/<suite>.robot` or `robot tests/robot/ui/<suite>.robot`
|
||||
- **Group related fixes** when multiple tests fail for the same root cause (e.g., Tasks 21–23, 32–38) to avoid redundant work.
|
||||
- **Check existing tests** in `tests/robot/api/` and `tests/robot/ui/` to understand the expected request/response format and UI interactions.
|
||||
- **Check existing tests** in `tests/robot/api/` and `tests/robot/ui/` to understand the expected request/response format and UI interactions.
|
||||
@@ -69,6 +69,7 @@ class DetailedHealthStatus(BaseModel):
|
||||
version: str = APP_VERSION
|
||||
dependencies: DependencyHealth
|
||||
startup_time: datetime
|
||||
uptime: str
|
||||
|
||||
|
||||
# Global startup time
|
||||
@@ -298,11 +299,16 @@ async def detailed_health_check(
|
||||
system=system_metrics,
|
||||
)
|
||||
|
||||
# Calculate uptime
|
||||
uptime_delta = datetime.now() - startup_time
|
||||
uptime_str = str(uptime_delta).split('.')[0] # Remove microseconds
|
||||
|
||||
return DetailedHealthStatus(
|
||||
status=overall_status,
|
||||
timestamp=datetime.now().isoformat(),
|
||||
dependencies=dependencies,
|
||||
startup_time=startup_time,
|
||||
uptime=uptime_str,
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error("Detailed health check failed: %s", e)
|
||||
|
||||
Reference in New Issue
Block a user