Skip to content

Resolve temp dir to real path in skills and installer unit tests#3928

Merged
reyortiz3 merged 2 commits intomainfrom
fix-skill-and-installer-tests-using-real-temp-dir
Feb 23, 2026
Merged

Resolve temp dir to real path in skills and installer unit tests#3928
reyortiz3 merged 2 commits intomainfrom
fix-skill-and-installer-tests-using-real-temp-dir

Conversation

@reyortiz3
Copy link
Copy Markdown
Contributor

@reyortiz3 reyortiz3 commented Feb 21, 2026

Resolve temp dir to real path in skills tests

The edits make tests use the resolved temporary directory path (no symlinks) instead of whatever t.TempDir() returns.

  1. pkg/skills/installer_test.go
  • TestExtract: Replaces t.TempDir() with filepath.EvalSymlinks(t.TempDir()) so targetDir is under the real path.
  • TestExtract_PermissionsSanitized: Same pattern for the perms test’s targetDir.
  1. pkg/skills/skillsvc/skillsvc_test.go
  • New helper tempDir(t): returns filepath.EvalSymlinks(t.TempDir()), marked with t.Helper().
  • All temp dir usage in that file is switched to tempDir(t) (or filepath.Join(tempDir(t), ...)) instead of t.TempDir() in:
    • TestInstallWithExtraction (several cases)
    • TestInstallFromOCI (OCI store dirs, skill dirs, target dirs)

Why this helps

On macOS, the default temp dir often goes through a symlink (e.g. /var/folders/.../private/var/folders/...), therefore, installer_test and skillssvc_test failing on macOS with:

extracting skill: target path validation: symlink found at "/var": refusing to extract through symlinks

If tests pass a symlinked path but the code under test (or libraries like the OCI store) resolve paths to their real location, you can get:

  • Path comparison mismatches
  • “Path not found” or wrong working dir
  • Flaky or environment-dependent failures
    Using filepath.EvalSymlinks(t.TempDir()) (and the shared tempDir(t) helper) makes tests use the same canonical path the rest of the code sees, which stabilizes these tests on systems where the temp dir is a symlink.

@reyortiz3 reyortiz3 requested a review from JAORMX as a code owner February 21, 2026 04:01
@github-actions github-actions Bot added the size/XS Extra small PR: < 100 lines changed label Feb 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.69%. Comparing base (7095e8e) to head (7e437c9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3928      +/-   ##
==========================================
+ Coverage   67.63%   67.69%   +0.06%     
==========================================
  Files         438      438              
  Lines       44108    44108              
==========================================
+ Hits        29833    29860      +27     
+ Misses      11939    11912      -27     
  Partials     2336     2336              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Feb 23, 2026
@reyortiz3 reyortiz3 merged commit a12a4b9 into main Feb 23, 2026
21 checks passed
@reyortiz3 reyortiz3 deleted the fix-skill-and-installer-tests-using-real-temp-dir branch February 23, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants