Skip to content

test: adapt test cases for Windows 10 environment#95

Merged
DeRuina merged 6 commits intoDeRuina:mainfrom
qiyoulin-ops:main
Apr 21, 2026
Merged

test: adapt test cases for Windows 10 environment#95
DeRuina merged 6 commits intoDeRuina:mainfrom
qiyoulin-ops:main

Conversation

@qiyoulin-ops
Copy link
Copy Markdown
Contributor

Summary

fix(test): skip Windows permission tests, close unclosed resources, isolate Linux-specific code

  1. Skip permission-related tests on Windows due to OS differences
  2. Add missing resource cleanup (logger) in test cases
  3. Move Linux-specific code (syscall.Umask) to build-tagged files

Type

  • Bug fix
  • Feature
  • Refactor / chore
  • Docs
  • Tests

Details

Run go test -v . under Windows 10

Tests

  • go test ./... passes locally
  • Added or updated tests
  • Verified behavior manually

Backwards compatibility

  • No breaking changes
  • Includes breaking changes (documented)

Related issues

Fixes # (if applicable)

…solate Linux-specific code

1. Skip permission-related tests on Windows due to OS differences
2. Add missing resource cleanup (logger) in test cases
3. Move Linux-specific code (syscall.Umask) to build-tagged files
@DeRuina
Copy link
Copy Markdown
Owner

DeRuina commented Apr 16, 2026

@qiyoulin-ops there are some checks failing. Once you fix them I would review happily 👍

@forTWOS
Copy link
Copy Markdown

forTWOS commented Apr 17, 2026

Addressed the following based on feedback:

  • Backward compatibility with older Go versions (previously missing)
  • Optimized test cases that were not applicable when running as root in the original version

PTAL.

@DeRuina DeRuina changed the title fix(test): adapt test cases for Windows 10 environment test: adapt test cases for Windows 10 environment Apr 20, 2026
@DeRuina DeRuina requested a review from Copilot April 20, 2026 11:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adapts the test suite to run reliably on Windows 10 by avoiding OS-specific permission assumptions, ensuring resources are closed, and moving non-Windows-only tests into a dedicated file.

Changes:

  • Skip permission-retention assertions on Windows for TestOpenExisting.
  • Add missing Close() calls in tests to avoid file handle leaks/locks.
  • Move permission/Umask-dependent tests into a non-Windows test file.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
timberjack_test.go Adds Windows skips/resource cleanup and relaxes path assertions for OS portability.
timberjack_linux_test.go Introduces non-Windows (currently effectively Linux-only) tests that rely on POSIX permissions/syscall.Umask.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread timberjack_test.go
Comment thread timberjack_test.go
Comment thread timberjack_linux_test.go
Comment thread timberjack_linux_test.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread timberjack_linux_test.go
Comment thread timberjack_linux_test.go Outdated
Comment thread timberjack_test.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread timberjack_test.go
Comment thread timberjack_test.go
Comment thread timberjack_test.go

This comment was marked as outdated.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread timberjack_linux_test.go
Comment thread timberjack_test.go
@DeRuina DeRuina merged commit cb7fbef into DeRuina:main Apr 21, 2026
4 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.

4 participants