Fix ZipHelperTests CI failure by removing fragile directory traversal#4831
Merged
liliankasem merged 1 commit intomainfrom Mar 19, 2026
Merged
Fix ZipHelperTests CI failure by removing fragile directory traversal#4831liliankasem merged 1 commit intomainfrom
liliankasem merged 1 commit intomainfrom
Conversation
d22a32d to
00f52bd
Compare
satvu
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
ZipHelperTests.CreateZip_Succeedsfailing on certain Windows CI agents with:System.UnauthorizedAccessException: Access to the path 'C:\Users\cloudtest\Application Data' is denied.Problem
The test located
ZippedExe.csprojby walking up exactly 4 parent directories from the CWD, then doing a recursiveGetFilessearch from there. This approach had two issues:out/bin/Azure.Functions.Cli.UnitTests/debug/), which could break if the build layout changes.SearchOption.AllDirectoriestraverses the entire directory tree, including protected Windows junction points (e.g.,Application Data→AppData\Roaming) that throwUnauthorizedAccessException.Fix
Replaced both the hardcoded parent traversal and recursive search with:
Azure.Functions.Cli.slnas a root marker — works regardless of output directory depth.test/ZippedExe/) instead of recursively scanning —ZippedExe.csprojis always at a fixed location relative to the repo root.outPathfrom repo root instead of relative..navigation from the csproj directory.No recursive directory enumeration of unknown trees is performed anymore.
Changes
test/Cli/Func.UnitTests/HelperTests/ZipHelperTests.cs— refactoredBuildAndCopyFileToZipAsyncto find repo root deterministically