Skip to content

Commit

Permalink
convert file path to file uri in TestVerifiedHash
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
anjannath committed Oct 6, 2023
1 parent dce8f6a commit fedda02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/crc/machine/bundle/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

0 comments on commit fedda02

Please sign in to comment.