fix(skill): tail_file test uses OS-specific absolute path - #231
Conversation
|
Thanks for the focused test portability fix. The change itself looks reasonable, but this PR is currently BLOCKED and has no CI results. Please rebase it onto the latest main and restore the required checks; once the test suite is green, this can be reviewed and merged independently of the Windows Edge stack. |
upstream tail_file_test.go 第 114 行用 hardcoded "/tmp/..." 作为不存在的绝对路径, 在 Windows 上 /tmp/... 不是 absolute(Windows 需要 C:\ 前缀),filepath.IsAbs 返回 false → 测试期望 err==nil 但实际返回 "path must be absolute" → FAIL。 改用 filepath.Join(os.TempDir(), "...") 拼路径: - Linux/macOS: /tmp/this-file-does-not-exist-ongrid-test - Windows: C:\Users\<user>\AppData\Local\Temp\this-file-does-not-exist-ongrid-test 两平台都满足 filepath.IsAbs,测试达到原意图(验证 file-not-found 错误)。 独立于 Windows edge PR 链(PR1 ongridio#228 / PR2 ongridio#229 / cleanup ongridio#230 / PR3 待开), 对所有平台有益,可立即 merge 到 main。
4344263 to
1daeb93
Compare
|
@singchia Rebased onto Local verification:
CI status: Workflow runs are in |
|
The cross-platform direction is right. Please use a test-owned directory instead of a fixed filename under notExistPath := filepath.Join(t.TempDir(), "missing.log")
|
Cross-platform fix for
TestTailFile_Execute_NotFound. Independent of the Windows edge PR chain (#228 / #229 / #230).Problem
The test hardcoded
/tmp/this-file-does-not-exist-ongrid-testas a non-existent absolute path. On Windows/tmp/...is not absolute (Windows requires aC:\-style drive prefix), sofilepath.IsAbsreturns false, the test gets"path must be absolute"instead of the expected file-not-found error, FAIL on Windows.Fix
Use
filepath.Join(os.TempDir(), "..."):/tmp/this-file-does-not-exist-ongrid-testC:\Users\<user>\AppData\Local\Temp\this-file-does-not-exist-ongrid-testBoth satisfy
filepath.IsAbs, preserving the original test intent.Scope
1 file, 3 insertions / 1 deletion. Test-only change, no production code touched.
Verification
go test -run TestTailFile_Execute_NotFound ./internal/skill/builtin/passes on Windowsgo test ./internal/skill/builtin/passesWhy independent PR
Discovered while running PR3 Windows tests, but the bug and fix are platform-wide (not Windows-edge specific). Keeping it independent lets it merge quickly without waiting for the Windows edge chain (which will take 1-2 months to review).
Contribution