Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add an automated graceful-shutdown test for `extenddb serve --foreground`

未关闭
#137 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
冷清
技术栈
aws, python, rust
领域
backend, testing

调研方向

Read crates/bin/src/cmd_serve.rs::run and crates/server/src/lib.rs::start_server, then inspect the existing test harness to find how it launches the server. Add a subprocess lifecycle test that waits for /health, sends SIGTERM, and checks the exit status, PID file removal, and shutdown log; isolate the run directory and capture stderr without races. Done means the test reliably covers graceful shutdown in CI.

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

描述

Problem or use case

PR #126 added --foreground for running extenddb serve under a process supervisor. The supervisor scenario relies on graceful SIGTERM shutdown: the process must drain in-flight connections, remove its PID file, and exit non-zero only on actual failure.

Today, this is verified manually (the PR description shows kill -TERM against a foreground process), but there's no automated coverage. A regression in the signal-handling path would not be caught by CI.

The reviewer on #126 explicitly suggested cutting this as a follow-up because the current test framework is not yet set up for whole-process lifecycle tests, so the work likely involves harness changes too.

Proposed solution

Add a Python integration test (or rust integration test under tests/) that:

  1. Spawns extenddb serve --foreground as a subprocess with stdout/stderr piped.
  2. Waits for the listener to come up (poll /health until 200, with a timeout).
  3. Optionally drives a PutItem through the AWS SDK to confirm a real request path is open.
  4. Sends SIGTERM to the child.
  5. Asserts the process exits with status 0 within a graceful-shutdown deadline (e.g., 10s).
  6. Asserts the PID file at ~/.extenddb/run/extenddb-<port>.pid was removed.
  7. Asserts stderr contains the expected Shutdown signal received, draining connections... log line.

This will probably require small additions to the test harness:

  • A way to launch extenddb with isolated ~/.extenddb/ (e.g., via HOME override or a --run-dir option).
  • A way to grep child stderr without racing the test runner.
Context
  • PR #126 review comment by pdf-amzn, item 3.
  • Current foreground code path: crates/bin/src/cmd_serve.rs::run (skips daemonize block) and crates/server/src/lib.rs::start_server (existing graceful-shutdown handler).

Checklist

  • I have searched existing issues and the roadmap for duplicates
  • I have described the use case, not just the desired implementation
主要语言
Rust
星标
517
派生
60
平均合并
2 天 23 小时
30 天内合并 PR
25

环境准备

从这里开始

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

ExtendDB/extenddb 的其他 Issue

查看 ExtendDB/extenddb 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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