test(breg): the source successor test and frozen_rhai_package leak a container, a volume and a temp dir every run

未关闭 适合新手
#2,632 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
67/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
docker, postgresql, rust
领域
devops, testing

调研方向

阅读 crates/registry-bregctl/tests/dev_lifecycle.rs 和 crates/registry-breg/tests/frozen_rhai_package.rs,然后检查会话清理行为以及共享 TempDir 的创建方式。运行受影响的测试目标,并检查它们是否未留下任何容器、卷或临时目录;保留需要容器停止状态的断言。

由索引模型根据 Issue 内容生成。

描述

area:breg bug rust

What happens

Two BReg test targets leave resources behind on every run:

  1. crates/registry-bregctl/tests/dev_lifecycle.rs: the source successor test ends with session.stop(); std::mem::forget(session);. stop() keeps the container and its volume, and forget skips the session's Drop cleanup, so each run leaves one breg-dev PostgreSQL container and one breg-dev-<uuid> volume. The two tests that call session.remove() before forget are fine.
  2. crates/registry-breg/tests/frozen_rhai_package.rs: the shared base copy is a tempfile::TempDir held in a static OnceLock. Statics are never dropped, so every run leaves one breg-native-package-* directory under TMPDIR.

On a developer machine these pile up across runs (disk, Docker volumes) and make container-ownership checks noisier.

Suggested fix

  1. Call session.remove() (after the assertions that need the stopped state) before forget, or drop forget if Drop already does the right cleanup.
  2. Keep the base copy in a TempDir owned by the test (or created per test), or register a removal at process exit. If the shared copy is kept for speed, use a stable, named path under the target directory that each run reuses.

Found while verifying the external record projections branch (feat/breg-external-views).

主要语言
Rust
星标
2
派生
0
平均合并
7 小时 43 分钟
30 天内合并 PR
201

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

registrystack/registry-stack 的其他 Issue

查看 registrystack/registry-stack 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。