Skip to content

RDKEMW-15146: Fix and expand unit tests for isSecureDbgSrvUnlocked() gating logic - #216

Draft
KTirumalaSrihari with Copilot wants to merge 2 commits into
topic/RDKEMW-13335from
copilot/sub-pr-205-another-one
Draft

RDKEMW-15146: Fix and expand unit tests for isSecureDbgSrvUnlocked() gating logic#216
KTirumalaSrihari with Copilot wants to merge 2 commits into
topic/RDKEMW-13335from
copilot/sub-pr-205-another-one

Conversation

Copilot AI commented Mar 17, 2026

Copy link
Copy Markdown

Existing GetServURL unit tests were broken by the refactored isSecureDbgSrvUnlocked(BUILDTYPE) and lacked coverage for the new ePROD unlock conditions (labsigned + deviceType RFC + debug services RFC).

Test fixes

  • VBN/non-PROD tests: Removed stale isDebugServicesEnabled().Times(1) expectations — non-PROD builds now return true from isSecureDbgSrvUnlocked() immediately without calling it, causing gMock TearDown failures.

  • PROD + debug-enabled tests: Added required mock expectations for getDeviceTypeRFC() (→ "test") and getDevicePropertyData("LABSIGNED_ENABLED") (→ "true", UTILS_SUCCESS) — both are now unconditionally called for all ePROD builds before the dbgServices check.

  • PROD + debug-disabled tests: Same two new mock expectations added; dbgServices=false still prevents unlock but the calls still happen.

New test coverage

Three new tests covering the remaining ePROD gating combinations:

Test DeviceType LABSIGNED_ENABLED dbgServices Expected
Locked_Prod_WrongDeviceType "prod" "true" true locked → RFC URL
Locked_Prod_LabsignedNotEnabled "test" "false" true locked → RFC URL
Locked_Prod_LabsignedReadFail "test" read fails true locked → RFC URL

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Remove broken isDebugServicesEnabled() Times(1) from VBN (non-PROD) tests
  (non-PROD builds now bypass this call since they are always unlocked)
- Add getDeviceTypeRFC and getDevicePropertyData(LABSIGNED_ENABLED) mock
  expectations to PROD+debug-enabled tests (required for ePROD unlock)
- Add getDeviceTypeRFC and getDevicePropertyData(LABSIGNED_ENABLED) mock
  expectations to PROD+debug-disabled tests (both are called for all ePROD
  builds before the dbgServices check)
- Add 3 new tests covering new gating combinations:
  - TestName_GetServURL_Locked_Prod_WrongDeviceType (deviceType=prod, locked)
  - TestName_GetServURL_Locked_Prod_LabsignedNotEnabled (labsigned=false, locked)
  - TestName_GetServURL_Locked_Prod_LabsignedReadFail (read fails, locked)
- Add size > 0 guards in Invoke lambdas to prevent size_t underflow"

Co-authored-by: KTirumalaSrihari <102281309+KTirumalaSrihari@users.noreply.github.com>
Copilot AI changed the title [WIP] [RDKEMW-15146] Introduce mechanism to unlock debug service RDKEMW-15146: Fix and expand unit tests for isSecureDbgSrvUnlocked() gating logic Mar 17, 2026
Copilot AI requested a review from KTirumalaSrihari March 17, 2026 07:20
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.

2 participants