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

Đang mở Phù hợp với người mới
#2,632 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
67/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker, postgresql, rust
Lĩnh vực
devops, testing

Hướng nghiên cứu

Đọc crates/registry-bregctl/tests/dev_lifecycle.rs và crates/registry-breg/tests/frozen_rhai_package.rs, sau đó kiểm tra hành vi dọn dẹp phiên và cách TempDir dùng chung được tạo. Chạy các mục tiêu kiểm thử bị ảnh hưởng và kiểm tra để bảo đảm chúng không để lại container, volume hay thư mục tạm nào; giữ lại các assertion cần trạng thái container đã dừng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).

Ngôn ngữ chính
Rust
Star
2
Fork
0
Merge trung bình
7 giờ 43 phút
Pull request đã merge (30 ngày)
201

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của registrystack/registry-stack

Tất cả issue của registrystack/registry-stack

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.