Skip to content

Automate API test scenarios for region endpoints.#1081

Closed
sbelhaik wants to merge 1 commit intorelease-2026.0from
sbel/roi-api
Closed

Automate API test scenarios for region endpoints.#1081
sbelhaik wants to merge 1 commit intorelease-2026.0from
sbel/roi-api

Conversation

@sbelhaik
Copy link
Contributor

@sbelhaik sbelhaik commented Feb 24, 2026

📝 Description

Automate API test scenarios for region endpoints.

JIRA: ITEP-87675

✨ Type of Change

Select the type of change your PR introduces:

  • 🐞 Bug fix – Non-breaking change which fixes an issue
  • 🚀 New feature – Non-breaking change which adds functionality
  • 🔨 Refactor – Non-breaking change which refactors the code base
  • 💥 Breaking change – Changes that break existing functionality
  • 📚 Documentation update
  • 🔒 Security update
  • 🧪 Tests
  • 🚂 CI

🧪 Testing Scenarios

Describe how the changes were tested and how reviewers can test them too:

  • ✅ Tested manually
  • 🤖 Ran automated end-to-end tests

✅ Checklist

Before submitting the PR, ensure the following:

  • 🔍 PR title is clear and descriptive
  • 📝 For internal contributors: If applicable, include the JIRA ticket number (e.g., ITEP-123456) in the PR title. Do not include full URLs
  • 💬 I have commented my code, especially in hard-to-understand areas
  • 📄 I have made corresponding changes to the documentation
  • ✅ I have added tests that prove my fix is effective or my feature works

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sbelhaik sbelhaik requested a review from Copilot February 25, 2026 12:15
@sbelhaik sbelhaik changed the base branch from main to release-2026.0 February 25, 2026 12:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 8 comments.

Comment on lines +222 to +234
"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
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +266 to +274
"step_name": "Attempt to get region with invalid UID",
"api": "region",
"method": "getRegion",
"request": {
"UID": "123"
},
"expected_status": {
"status_code": 404
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +320 to +331
"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
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
},
"expected_status": {
"status_code": 404
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
}
}
},
{
"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
}

Copilot uses AI. Check for mistakes.
Comment on lines +50 to +72
"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"
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
}
},
"expected_status": {
"status_code": 400
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"status_code": 400
"status_code": 201

Copilot uses AI. Check for mistakes.
Comment on lines +154 to +176
"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"
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +199 to +214
"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
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@Irakus Irakus deleted the branch release-2026.0 February 25, 2026 15:41
@Irakus Irakus closed this Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants