Skip to content

test: 手机 IPC 测试等 updater 就绪后再调用更新命令 - #186

Merged
sunerpy merged 1 commit into
mainfrom
test/mobile-ipc-updater-race
Oct 24, 2026
Merged

sunerpy merged 1 commit into
mainfrom
test/mobile-ipc-updater-race

Conversation

@sunerpy

@sunerpy sunerpy commented Oct 24, 2026

Copy link
Copy Markdown
Owner

#184 的 rust gates 里,apps/mobile/src-tauri/tests/ipc.rs 的 an_install_from_play_is_updated_by_play_and_points_to_its_listing 失败一次(重跑通过):

left: Err(String("state not managed for field `updater` on command `update_status`. You must call `.manage()` before using this command"))

原因:build_app 的 setup 先在 attach_bridge 中管理 Bridge,之后才创建并管理 PhoneUpdater;测试线程只等 Bridge 出现就调用 update_status,在慢的 CI 机器上会早于 app.manage(updater)。

  • 修改:with_app_updating 在等 Bridge 之后,再等 Arc<PhoneUpdater> 出现。所有经过这个函数的测试都受益(三个测试一开始就调用 update_status)。
  • 复现:在 setup 的这两步之间临时加 300 ms 延迟,修改前每次都以同样的错误失败,修改后通过;延迟没有提交。
  • 压力测试:去掉延迟后,--test ipc 的 19 个测试在 32 核满载下连续运行 30 轮,全部通过。

只改测试,不改应用代码。

setup 先管理 Bridge、再管理 updater,测试线程只等 Bridge 时,慢的 CI 机器上 update_status 会报 state not managed(2026-10-24,#184 的 rust gates)。在 setup 的这两步之间加 300 ms 延迟可以稳定复现;改为同时等 updater 后,32 核满载下连续 30 轮全部通过。
@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #186      +/-   ##
==========================================
- Coverage   93.79%   93.77%   -0.02%     
==========================================
  Files         388      388              
  Lines       55271    55271              
  Branches     3743     3743              
==========================================
- Hits        51840    51832       -8     
- Misses       2935     2943       +8     
  Partials      496      496              
Flag Coverage Δ
rust 93.89% <ø> (-0.02%) ⬇️
web 93.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sunerpy
sunerpy merged commit fcc3ee3 into main Oct 24, 2026
16 checks passed
@sunerpy
sunerpy deleted the test/mobile-ipc-updater-race branch October 24, 2026 09: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.

1 participant