Skip to content

fix(test): skip POSIX permission assertions on Windows - #855

Merged
chenyme merged 2 commits into
chenyme:mainfrom
Huan-zhaojun:pr/qualityguard-windows-permissions
Aug 5, 2026
Merged

fix(test): skip POSIX permission assertions on Windows#855
chenyme merged 2 commits into
chenyme:mainfrom
Huan-zhaojun:pr/qualityguard-windows-permissions

Conversation

@Huan-zhaojun

Copy link
Copy Markdown
Collaborator

概述

v3.1.0 新增的 qualityguard 相关测试在 Windows 上必挂:bootstrap.jsonruntime-config.json 写入后断言文件权限为 0600,但 Windows 没有 POSIX 权限位os.WriteFile 的 mode 参数被忽略,文件恒为 0666 样式(Go 官方文档:Windows 仅使用 0200 位控制只读属性)。

改动

  • qualityguard/bootstrap_test.gotransport/http/egress/handler_test.go 的权限断言加 runtime.GOOS != "windows" 分支
  • Windows 上跳过该断言(属性不存在,无可断言对象;实际安全由 ACL 继承保证)
  • Linux / 容器部署环境断言完整保留

兼容性

  • 仅测试代码改动,零生产代码影响
  • Linux 行为不变(0600 断言照常执行)
  • Windows 本地开发从「测试必挂」变为「测试通过」

go test ./... 全绿。

Huan-zhaojun and others added 2 commits August 5, 2026 12:01
Windows has no POSIX permission bits: os.WriteFile mode is ignored and
files report 0666-style permissions, so the 0600 assertions in the
qualityguard bootstrap and runtime-config tests always fail on Windows.
Skip them on Windows; POSIX behavior is unchanged.

(cherry picked from commit 0b9d048)
@chenyme
chenyme merged commit a77162b into chenyme:main Aug 5, 2026
9 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.

2 participants