Skip to content

fix(test): use forward slash in MockFileSystem.Walk path matching - #611

Open
dipak0000812 wants to merge 1 commit into
microcks:masterfrom
dipak0000812:fix/601-mockfs-walk-path-separator
Open

dipak0000812 wants to merge 1 commit into
microcks:masterfrom
dipak0000812:fix/601-mockfs-walk-path-separator

Conversation

@dipak0000812

@dipak0000812 dipak0000812 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #601

MockFileSystem.Walk in cmd/importDir_test.go used filepath.Separator when matching child fixture paths against the requested root.

The mock filesystem fixtures use forward-slash paths regardless of the host operating system. On Windows, filepath.Separator resolves to \, causing the prefix check to fail for paths such as /test/openapi.yaml.

As suggested by @Caesarsage in #601, this changes the prefix check to use /, matching the path convention used by the mock filesystem.

The change is limited to test infrastructure and does not modify production import behavior.

Verification

  • All seven previously failing Windows subtests pass.
  • go test ./cmd/...
  • go vet ./cmd/...
  • git diff --check

Disclosure: Minimal AI assistance was used for issue investigation and PR preparation. The contributor reviewed the implementation and verified the changes locally.

MockFileSystem fixtures use forward-slash paths regardless of the host OS.
Matching child paths using filepath.Separator caused MockFileSystem.Walk
to fail prefix checks on Windows where separator is '\', causing 7 subtests
in TestImportDirectory and TestFindSpecificationFilesWithFS to fail.

Match on "/" instead of filepath.Separator so mock traversal is portable
across operating systems.

Closes microcks#601

Signed-off-by: Dipak Dhangar <[email protected]>

This branch was previously deployed

1 inactive deployment
Build — 69ca806a Deployed Oct 31, 2026 by dipak0000812 via build-verify-package #850
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.

Windows test failures in MockFileSystem.Walk due to path separator

1 participant