CycloneDX / cyclonedx-cli

CycloneDX CLI tool for SBOM analysis, merging, diffs and format conversions.
https://cyclonedx.org/
Apache License 2.0
317 stars 62 forks source link

Tests on MacOS fail due issue with snapshooter #368

Open andreas-hilti opened 6 months ago

andreas-hilti commented 6 months ago

Snapshooter tries to access "/_" instead of the full path.

See https://github.com/SwissLife-OSS/snapshooter/issues/196

For instance,

  Failed CycloneDX.Cli.Tests.ConvertTests.ConvertToSpdxJson(outputFormat: spdxjson) [9 ms]
  Error Message:
   System.UnauthorizedAccessException : Access to the path '/_/tests/cyclonedx.tests/__snapshots__' is denied.
---- System.IO.IOException : Permission denied
  Stack Trace:
     at System.IO.FileSystem.CreateDirectory(String fullPath)
   at System.IO.Directory.CreateDirectory(String path)
   at Snapshooter.Core.SnapshotFileHandler.CreateFolderIfNotExist(String folderPath)
   at Snapshooter.Core.SnapshotFileHandler.EnsureSnapshotFolder(SnapshotFullName snapshotFullName)
   at Snapshooter.Core.SnapshotFileHandler.ReadSnapshot(SnapshotFullName snapshotFullName)
   at Snapshooter.SnapshotAssert.AssertSnapshot(Object currentResult, SnapshotFullName snapshotFullName, Func`2 matchOptions)
   at Snapshooter.Snapshooter.AssertSnapshot(Object currentResult, SnapshotFullName snapshotFullName, Func`2 matchOptions)
   at Snapshooter.Xunit.Snapshot.Match(Object currentResult, SnapshotFullName snapshotFullName, Func`2 matchOptions)
   at Snapshooter.Xunit.Snapshot.Match(Object currentResult, SnapshotNameExtension snapshotNameExtension, Func`2 matchOptions)
   at Snapshooter.Xunit.Snapshot.Match[T](T currentResult, SnapshotNameExtension snapshotNameExtension, Func`2 matchOptions)
   at CycloneDX.Cli.Tests.ConvertTests.ConvertToSpdxJson(ConvertFormat outputFormat) in /_/tests/cyclonedx.tests/ConvertTests.cs:line 126
--- End of stack trace from previous location ---

On Windows and Linux, workarounds were merged with https://github.com/CycloneDX/cyclonedx-cli/pull/367.