Skip to content

v2.4.0 - pytest 测试系统 + 规范整改

Choose a tag to compare

@SnowCore8 SnowCore8 released this 05 Nov 08:25
· 290 commits to master since this release

新增功能

pytest 测试系统基础设施

  • 添加 pyproject.toml 配置 pytest 和 coverage
  • 添加 tests/requirements.txt 定义测试依赖
  • 添加 tests/README.md 测试系统文档
  • 实现测试标记系统(requires_daemon/slow/stress/requires_sqlite3)
  • 提取共享 fixture(check_daemon/running_daemon)
  • CI 生成 JUnit XML + HTML 报告并上传 artifact
  • Makefile 添加 test-html/test-cov 目标

规范整改

FHS 路径合规

  • debian/rules daemon 路径 /usr/local/sbin → /usr/sbin
  • debian/rules systemd 路径 /etc/systemd/system → /lib/systemd/system
  • deploy.sh SBINDIR /usr/local/sbin → /usr/sbin
  • firewall-daemon.service ExecStart 默认路径 /usr/local/sbin → /usr/sbin

安全加固

  • 清空 config/default.yaml 中的明文凭据,引导使用 credentials.env
  • systemd 单元添加 ProtectKernelLogs/ProtectClock/PrivateDevices/RestrictAddressFamilies/UMask
  • 修正 metrics_bind_address 文档默认值 127.0.0.1 → 0.0.0.0

CI/CD 规范

  • gofmt lint 改为 test -z 断言确保失败时报错
  • 添加 shellcheck 检查 build-deb.sh 和 scripts/*.sh
  • 固定 Go 版本为 1.26(actions/setup-go@v5)

版本号管理

  • CHANGELOG [Unreleased] → v2.4.0,统一版本号
  • build-deb.sh auto_version() 跳过 [Unreleased],fallback 提升到 2.4.0

文档一致性

  • Node.js 版本文档 22 → 24
  • 日志文件命名统一为 firewall.log
  • building.md 状态目录出处 STATEDIR → $(STATEDIR)/firewall
  • AGENTS.md 补充 kmod 是 kernel-module 的快捷别名
  • redis.yaml 智能推断注释修正为 defaults 的 3/600/900

构建产物

  • linux-firewall-kmod-2.4.0.deb - Debian 软件包(DKMS 模式,安装时编译内核模块)

测试结果

  • 75 passed, 22 skipped, 0 failed
  • 标记系统生效:22 个需要外部 daemon 的测试被正确跳过

What's Changed

  • docs: align architecture framework by @SnowCore8 in #10
  • fix: 修复多处设计缺陷(锁泄漏/鉴权/缓存 TOCTOU/历史记录) by @SnowCore8 in #11
  • chore(deps): bump undici 6.25.0 → 6.27.0 in /docs by @SnowCore8 in #12
  • chore(deps): bump docs npm transitive deps (undici 6.28.0 等) by @SnowCore8 in #14
  • chore(deps): bump qs from 6.15.2 to 6.16.0 in /docs in the npm_and_yarn group across 1 directory by @dependabot[bot] in #15
  • chore(deps): bump the npm_and_yarn group across 1 directory with 2 updates by @dependabot[bot] in #16
  • chore(deps): bump undici from 6.28.0 to 6.29.0 in /docs in the npm_and_yarn group across 1 directory by @dependabot[bot] in #17

New Contributors

Full Changelog: v2.2.0...v2.4.0