Skip to content

test: sync DEF-003 pinning test with fixed disableOutDevice behavior - #952

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:ut-t27-sync1
Oct 29, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:ut-t27-sync1

Conversation

@add-uos

@add-uos add-uos commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

背景

PR #937 合入上游 master 后,缺陷修复提交 3645c98(UT-DEF-003:disableOutDevice 中 authorized 文件打开失败分支 return → continue)只改了源码,未同步更新配套 pinning 测试,导致 master 上 EnableUtilsTest.disableOutDevice_usbFileOpenFails_abortsRemainingItems 断言旧缺陷行为、测试变红。

本 PR 同步该 pinning 测试到修复后行为:

  • 用例更名为 disableOutDevice_usbFileOpenFails_continuesRemainingItems
  • 断言改为:打开失败的 USB 条目被跳过(不写文件、不更新库),后续网卡条目继续被禁用(ioctl 调用 1 次,DB path 更新为 Device File)

验证

  • deepin-devicemanager-server-test(EnableSqlManager* / EnableUtilsTest.* / WakeupUtilsTest.*):122/122 全部通过
  • SPDX 检查(changed-files vs upstream/master):Failed: 0

关联

Summary by Sourcery

Align the disableOutDevice pinning test with the upstream fix so it validates that USB authorization failures do not prevent later devices from being disabled.

Enhancements:

  • Synchronize the DEF-003 pinning test with the fixed disableOutDevice behavior by verifying failed USB entries are skipped while subsequent devices continue processing.

Tests:

  • Update the EnableUtilsTest case name and assertions to cover continued processing, ioctl invocation, database updates, and unchanged state for the failed USB entry.

…evice

Upstream commit 3645c98 changed the authorized-file-open-failure branch
in disableOutDevice from return to continue (UT-DEF-003 reported by
ut_enableutils.cpp pinning test). The pinning test still asserted the
old aborting behavior, leaving the suite red on master.

- rename disableOutDevice_usbFileOpenFails_abortsRemainingItems to
  ..._continuesRemainingItems and assert the fixed behavior: the USB
  item whose authorized file cannot be opened is skipped, the remaining
  network item is still disabled via ioctl and its DB path updated
- suites EnableSqlManager*/EnableUtilsTest/WakeupUtilsTest: 122/122 pass
@sourcery-ai

sourcery-ai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Sorry @add-uos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 13 hours and 30 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the DEF-003 pinning test to validate the upstream fix that continues processing remaining devices when a USB authorized file cannot be opened, while preserving the failed item’s state.

File-Level Changes

Change Details Files
Synchronize the DEF-003 pinning test with the corrected continue-on-error behavior.
  • Rename the test to describe continued processing after a USB authorized-file open failure.
  • Assert that the failed USB item is skipped without ioctl, file write, or database update.
  • Assert that the subsequent network device is disabled with one ioctl and its database path updated to the device file.
deepin-devicemanager-server/tests/src/EnableControl/ut_enableutils.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次变更为单元测试用例同步更新,将 DEF-003 pinning 测试的断言从验证缺陷行为(return 提前退出循环)改为验证上游修复后的正确行为(continue 跳过当前条目继续处理后续设备)。变更范围小且聚焦,测试结构清晰,注释充分说明修复上下文。四维度均无问题,AI 分析、启发式扫描、OCR 审查三方结果一致,未发现安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

本次变更无需修复,代码已符合规范。测试用例正确验证了修复后的行为: 当 USB 设备 authorized 文件打开失败时,disableOutDevice 函数使用 continue 跳过当前条目, 循环继续处理后续设备(如网卡),而非使用 return 提前退出整个循环。

本报告由 AI 代码审查工具自动生成

@deepin-bot

deepin-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.0.75
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #956

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos

add-uos commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
deepin-bot Bot merged commit f45ff06 into linuxdeepin:master Oct 29, 2026
17 checks passed
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