From 6d19804f7cb9eacb54918ee5bbfa7e69b96b3cfd Mon Sep 17 00:00:00 2001 From: DmitriyLewen Date: Mon, 18 Mar 2024 14:52:44 +0600 Subject: [PATCH] refactor: use ToSlash for sbom_test --- integration/sbom_test.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/integration/sbom_test.go b/integration/sbom_test.go index 58f785935688..65c99f9e9600 100644 --- a/integration/sbom_test.go +++ b/integration/sbom_test.go @@ -3,11 +3,10 @@ package integration import ( - ftypes "github.com/aquasecurity/trivy/pkg/fanal/types" "path/filepath" - "strings" "testing" + ftypes "github.com/aquasecurity/trivy/pkg/fanal/types" v1 "github.com/google/go-containerregistry/pkg/v1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -243,9 +242,9 @@ func compareSBOMReports(t *testing.T, wantFile, gotFile string, overrideWant typ got := readReport(t, gotFile) // when running on Windows FS - got.ArtifactName = strings.ReplaceAll(got.ArtifactName, "\\", "/") + got.ArtifactName = filepath.ToSlash(filepath.Clean(got.ArtifactName)) for i, result := range got.Results { - got.Results[i].Target = strings.ReplaceAll(result.Target, "\\", "/") + got.Results[i].Target = filepath.ToSlash(filepath.Clean(result.Target)) } assert.Equal(t, want, got) }