From fedda021fe013d7ca382cdddaa54f4644b60cbd8 Mon Sep 17 00:00:00 2001 From: Anjan Nath Date: Tue, 3 Oct 2023 19:54:29 +0530 Subject: [PATCH] convert file path to file uri in TestVerifiedHash this uses filepath.ToSlash function to convert root of the filepath to either slash or windows drive letter it fixes the following unit test failure on windows: ``` === RUN TestVerifiedHash metadata_test.go:214: Error Trace: D:/a/crc/crc/pkg/crc/machine/bundle/metadata_test.go:214 D:/a/crc/crc/pkg/crc/machine/bundle/metadata_test.go:193 Error: Received unexpected error: parse "file://D:\\a\\crc\\crc\\pkg\\crc\\machine\\bundle\\testdata\\sha256sum_correct_4.13.0.txt.sig": invalid port ":\\a\\crc\\crc\\pkg\\crc\\machine\\bundle\\testdata\\sha256sum_correct_4.13.0.txt.sig" after host Test: TestVerifiedHash ``` --- pkg/crc/machine/bundle/metadata_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/crc/machine/bundle/metadata_test.go b/pkg/crc/machine/bundle/metadata_test.go index cff984a982..61134f9b0b 100644 --- a/pkg/crc/machine/bundle/metadata_test.go +++ b/pkg/crc/machine/bundle/metadata_test.go @@ -209,5 +209,5 @@ func TestVerifiedHash(t *testing.T) { func testDataURI(t *testing.T, sha256sum string) string { absPath, err := filepath.Abs(filepath.Join("testdata", sha256sum)) require.NoError(t, err) - return fmt.Sprintf("file:///%s", absPath) + return fmt.Sprintf("file://%s", filepath.ToSlash(absPath)) }