Skip to content

test: stabilize MPMC test etcd access via PyO3 rather than pylib etcd3#33

Merged
ActivePeter merged 2 commits into
mainfrom
padev29
Jul 2, 2026
Merged

test: stabilize MPMC test etcd access via PyO3 rather than pylib etcd3#33
ActivePeter merged 2 commits into
mainfrom
padev29

Conversation

@ActivePeter

@ActivePeter ActivePeter commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

PR Description EN

Background

The MPMC integration test was flaky because its test control-
plane logic used the Python etcd3 client directly. In CI,
that client occasionally failed to connect to etcd or hit
transient UNAVAILABLE / timeout errors, even when the actual
MPMC produce/consume flow had already succeeded.

Summary

This PR moves the MPMC test control-plane etcd operations to
the PyO3-backed etcd client, so tests reuse the same Tokio
runtime and etcd client lifecycle used by Fluxon runtime code.

Changes

  • Add minimal PyO3 etcd bindings for test control-plane
    operations.
  • Replace direct etcd3 usage in MPMC tests with the PyO3
    etcd client.
  • Move shared MPMC test etcd helper logic into test_lib.py.
  • Cache PyO3 etcd clients by endpoint and use RwLock for
    cached client access.
  • Add PyO3 etcd integration test coverage.
  • Improve MPMC subprocess failure diagnostics by including
    child log tails.

Validation

  • PyO3 etcd integration tests passed.
  • Rust fluxon_pyo3 etcd tests passed.
  • Affected Python test files compile.
  • Latest MPMC CI run passed.

PR 文案 CN

背景

MPMC 集成测试之前存在偶发失败:测试控制面直接使用 Python
etcd3 client 访问 etcd。在 CI 环境里,这个 client 偶尔会连接
不上 etcd,或者遇到 transient UNAVAILABLE / timeout 错误。失
败发生时,实际 MPMC produce/consume 流程经常已经成功,问题主要
出在测试侧 etcd 控制面访问不稳定。

概述

这个 PR 将 MPMC 测试控制面的 etcd 访问切到 PyO3 暴露的 etcd
client,让测试复用 Fluxon runtime 使用的 Tokio runtime 和 etcd
client 生命周期管理。

主要改动

  • 新增 PyO3 etcd 最小接口,覆盖当前测试需要的控制面操作。
  • MPMC 测试不再直接调用 Python etcd3
  • 将重复的 MPMC 测试 etcd helper 收敛到 test_lib.py
  • PyO3 etcd client 按 endpoint 缓存,并使用 RwLock 管理
    cached client。
  • 增加 PyO3 etcd 集成测试覆盖。
  • 改进 MPMC 子进程失败诊断,父进程日志会直接带 child log
    tail。

验证

  • PyO3 etcd 集成测试通过。
  • Rust fluxon_pyo3 etcd 单测通过。
  • 受影响 Python 测试文件编译通过。
  • 最新 MPMC CI 已通过。

@ActivePeter ActivePeter changed the title test test: stabilize MPMC test etcd access via PyO3 rather than pylib etcd3 Jul 2, 2026
@ActivePeter ActivePeter merged commit b5e061c into main Jul 2, 2026
4 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.

1 participant