Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Windows test failures in MockFileSystem.Walk due to path separator

Ouverte Adaptée aux débutants
#601 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
82/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
go
Domaine
testing

Piste de recherche

Lisez la méthode Walk dans cmd/importDir_test.go ainsi que les fixtures utilisées par TestImportDirectory et TestFindSpecificationFilesWithFS. Exécutez go test -v ./cmd -run "TestImportDirectory|TestFindSpecificationFilesWithFS" ; vérifiez comment les chemins des fixtures sont mis en correspondance sous la racine sous Windows. Le travail est terminé lorsque le parcours simulé trouve les fichiers fixtures et que les deux tests réussissent sous Windows.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Describe the bug

The directory import tests fail on Windows because MockFileSystem.Walk uses the operating system's path separator to match child paths, while the mock filesystem fixtures use forward slashes.

In cmd/importDir_test.go, the Walk method contains this check:

if path == root || strings.HasPrefix(path, root+string(filepath.Separator)) {

For a root path of /test, the prefix is /test/ on Linux, which matches fixture paths such as /test/openapi.yaml.

On Windows, filepath.Separator is \, so the prefix becomes /test\. This does not match the forward-slash fixture paths, causing the mock filesystem to skip child files.

Steps to reproduce

On Windows, run:

go test -v ./cmd -run "TestImportDirectory|TestFindSpecificationFilesWithFS"
Actual behavior

Seven subtests fail across TestImportDirectory and TestFindSpecificationFilesWithFS.

The directory import tests report:

no specification files found in directory: /test

The file-discovery tests return no matching specification files, even though the fixtures contain them.

Expected behavior

MockFileSystem.Walk should traverse fixture paths consistently across operating systems, and the affected tests should pass on Windows.

Context

The current .github/workflows/build-verify.yml workflow runs tests on Ubuntu, so these Windows-specific test failures are not caught by the existing CI workflow. The project also builds Windows binaries.

Possible fix

Normalize the paths consistently before checking whether a fixture is under the requested root, so the mock filesystem's path matching does not depend on the host operating system.

Microcks version or git rev

Reproduced on Windows amd64 with Go 1.27.0. The exact repository commit SHA used for the reproduction can be added if available.

Install method

Not applicable. This issue concerns Go unit tests for the CLI's mock filesystem.

Additional information

The issue affects test infrastructure rather than the production directory-import implementation. The fix should preserve the existing import behavior while making the mock filesystem portable across operating systems.

Langage dominant
Go
Étoiles
59
Forks
74
Merge moyen
5 j 17 h
PR mergées (30 j)
22

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microcks/microcks-cli

Toutes les issues de microcks/microcks-cli

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.