Automate API test scenarios for region endpoints.#1081
Automate API test scenarios for region endpoints.#1081sbelhaik wants to merge 1 commit intorelease-2026.0from
Conversation
There was a problem hiding this comment.
Pull request overview
Adds/updates automated test coverage across API scenario tests and functional MQTT visibility tests, plus some repo versioning/CI workflow updates.
Changes:
- Added new API scenario JSONs for region and asset endpoints.
- Refactored camera-bounds “visibility topic” functional test into a shared helper + three focused test cases and updated functional test make targets.
- Added an OpenAPI spec validation make target; bumped repo/Helm app versions and updated the DLStreamer update workflow.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
version.txt |
Bumps repo version from 2026.0.0-dev to 2026.0.0-rc1. |
kubernetes/scenescape-chart/Chart.yaml |
Aligns Helm appVersion with the new repo version. |
.github/workflows/update-dlstreamer.yml |
Adds manual dispatch and RC tag selection/PR base behavior to the DLStreamer update workflow. |
tests/functional/common_camera_bounds.py |
Introduces shared MQTT subscription + camera_bounds detection logic for visibility tests. |
tests/functional/tc_camera_bound_visibility_regulated.py |
New functional test for “regulated” visibility behavior. |
tests/functional/tc_camera_bound_visibility_unregulated.py |
New functional test for “unregulated” visibility behavior. |
tests/functional/tc_camera_bound_visibility_none.py |
New functional test for “none” visibility behavior. |
tests/functional/tc_camera_bound_visibility.py |
Removes the previous monolithic visibility test. |
tests/Makefile.functional |
Replaces the old visibility/loop target with explicit per-mode targets. |
tests/Makefile |
Wires in new visibility targets and adds an openapi-validation target. |
tests/api/scenarios/region_api.json |
Adds region API scenario coverage. |
tests/api/scenarios/asset_api.json |
Adds asset API scenario coverage. |
4438c49 to
9dd4c09
Compare
99a2121 to
6b680b1
Compare
| "step_name": "Attempt to update region with invalid UID", | ||
| "api": "region", | ||
| "method": "updateRegion", | ||
| "request": { | ||
| "UID": "123", | ||
| "body": { | ||
| "name": "Should_Fail", | ||
| "scene": "${SCENE_UID}" | ||
| } | ||
| }, | ||
| "expected_status": { | ||
| "status_code": 404 | ||
| } |
There was a problem hiding this comment.
For region endpoints the URL pattern accepts any string (/api/v1/region/<uid>), and the handler validates that <uid> is a UUIDv4; a value like "123" will typically return 400 (validation error), not 404. If the intent is “non-existent region”, use a valid-but-absent UUID and keep 404, or change the expected status to 400.
| "step_name": "Attempt to get region with invalid UID", | ||
| "api": "region", | ||
| "method": "getRegion", | ||
| "request": { | ||
| "UID": "123" | ||
| }, | ||
| "expected_status": { | ||
| "status_code": 404 | ||
| } |
There was a problem hiding this comment.
Same issue as above: UID: "123" is not a UUIDv4, so the region GET endpoint will typically return 400 (validation error) rather than 404. Use a valid UUID to test 404-not-found semantics, or update expected_status to 400.
| "test_name": "Vision_AI/SSCAPE/API/ROI/12: Delete non existent region", | ||
| "test_steps": [ | ||
| { | ||
| "step_name": "Attempt to delete region with invalid UID", | ||
| "api": "region", | ||
| "method": "deleteRegion", | ||
| "request": { | ||
| "UID": "123" | ||
| }, | ||
| "expected_status": { | ||
| "status_code": 404 | ||
| } |
There was a problem hiding this comment.
Same issue as above: deleting UID: "123" will typically return 400 (invalid UUID) on the region endpoint, not 404. For a true “non-existent” delete test, use a valid-but-absent UUID; otherwise adjust the expected status code.
| }, | ||
| "expected_status": { | ||
| "status_code": 404 | ||
| } |
There was a problem hiding this comment.
The scenario creates a Scene (name: "Scene1", which is unique in the backend) and also creates a “full” region, but only deletes the minimal region and never deletes the scene or the full region. This makes the scenario non-idempotent and can break repeated runs (e.g., scene creation will fail once Scene1 already exists). Add cleanup steps to delete REGION_UID_FULL and the created scene at the end.
| } | |
| } | |
| }, | |
| { | |
| "step_name": "Delete full region", | |
| "api": "region", | |
| "method": "deleteRegion", | |
| "request": { | |
| "UID": "${REGION_UID_FULL}" | |
| }, | |
| "expected_status": { | |
| "status_code": 200 | |
| } | |
| }, | |
| { | |
| "step_name": "Delete scene", | |
| "api": "scene", | |
| "method": "deleteScene", | |
| "request": { | |
| "UID": "${SCENE_UID}" | |
| }, | |
| "expected_status": { | |
| "status_code": 200 | |
| } |
| "body": { | ||
| "name": "Region_Full", | ||
| "scene": "${SCENE_UID}", | ||
| "vertices": [ | ||
| [ | ||
| 0.0, | ||
| 0.0 | ||
| ], | ||
| [ | ||
| 1.0, | ||
| 0.0 | ||
| ], | ||
| [ | ||
| 1.0, | ||
| 1.0 | ||
| ], | ||
| [ | ||
| 0.0, | ||
| 1.0 | ||
| ] | ||
| ], | ||
| "type": "polygon" | ||
| } |
There was a problem hiding this comment.
The Region API payload in this scenario uses vertices and type, but the backend serializer expects points (list of [x,y] pairs) and does not define a type field. As written, this step will likely return 400 “unknown field” instead of 201. Update the request body to use the server’s field names (e.g., points) and remove unsupported fields, then adjust downstream steps accordingly.
| } | ||
| }, | ||
| "expected_status": { | ||
| "status_code": 400 |
There was a problem hiding this comment.
This negative test assumes name is a required field and expects 400 when omitted, but the API handler creates serializers with partial=True, so missing fields may be accepted (resulting in a region created with an empty-string name). If the intent is to validate name enforcement, send an explicit invalid value (e.g., empty string/null) or update the expected status to match actual API behavior.
| "status_code": 400 | |
| "status_code": 201 |
| "body": { | ||
| "name": "Region_Full_Updated", | ||
| "scene": "${SCENE_UID}", | ||
| "vertices": [ | ||
| [ | ||
| 0.0, | ||
| 0.0 | ||
| ], | ||
| [ | ||
| 2.0, | ||
| 0.0 | ||
| ], | ||
| [ | ||
| 2.0, | ||
| 2.0 | ||
| ], | ||
| [ | ||
| 0.0, | ||
| 2.0 | ||
| ] | ||
| ], | ||
| "type": "polygon" | ||
| } |
There was a problem hiding this comment.
This update step includes fields (vertices, type) that are not part of the Region serializer fields (which uses points). That will likely cause a 400 “unknown field” instead of the expected 200. Align the update payload with the API contract (use points if updating geometry; omit unsupported fields).
| "test_name": "Vision_AI/SSCAPE/API/ROI/06: Update region with missing required field name", | ||
| "test_steps": [ | ||
| { | ||
| "step_name": "Attempt to update region without name", | ||
| "api": "region", | ||
| "method": "updateRegion", | ||
| "request": { | ||
| "UID": "${REGION_UID_MINIMAL}", | ||
| "body": { | ||
| "scene": "${SCENE_UID}", | ||
| "type": "polygon" | ||
| } | ||
| }, | ||
| "expected_status": { | ||
| "status_code": 400 | ||
| } |
There was a problem hiding this comment.
This test expects 400 when updating without name, but the API update path uses partial=True so omitting name is typically allowed. As written it may fail for the wrong reason (it also includes an unsupported type field). If you want a deterministic 400, provide an explicitly invalid name value; otherwise update the expected status.
📝 Description
Automate API test scenarios for region endpoints.
JIRA: ITEP-87675
✨ Type of Change
Select the type of change your PR introduces:
🧪 Testing Scenarios
Describe how the changes were tested and how reviewers can test them too:
✅ Checklist
Before submitting the PR, ensure the following: