notaryproject / notation-go

A collection of libraries for supporting sign and verify OCI artifacts. Based on Notary Project specifications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some unit tests fail on Windows platforms

Wwwsylvia opened this issue · comments

Some unit tests in store_test.go fail on Windows platforms, and the error message is like below:

--- FAIL: TestLoadTrustStoreWithSymlinks (0.01s)
store_test.go:28: symlinks should return error : "Error while reading certificates from "testdata\\trust-store\\trust-store-with-cert-symlinks\\GlobalSignRootCA_SYMLINK.crt". Error : "x509: malformed certificate""
--- FAIL: TestLoadTrustStoreWithDirs (0.00s)
store_test.go:35: sub directories should return error : ""testdata\\trust-store\\trust-store-with-directories\\sub-dir" is not a regular file (directories or symlinks are not supported)"
--- FAIL: TestLoadTrustStoreWithInvalidCerts (0.00s)
store_test.go:42: invalid certs should return error : %!q()
--- FAIL: TestLoadTrustStoreWithLeafCerts (0.01s)
store_test.go:49: leaf cert in a trust store should return error : "certificate with subject "CN=lol,OU=lol,O=lol,L=lol,ST=Some-State,C=AU,1.2.840.113549.1.9.1=#13036c6f6c" from file "testdata\\trust-store\\trust-store-with-leaf-certs\\non-ca.crt" is not a CA certificate, only CA certificates (BasicConstraint CA=True) are allowed"
FAIL
FAIL github.com/notaryproject/notation-go/verification 4.042s
FAIL

It's because these test functions check the returned error by comparing its error message with a hard-coded error string, but the returned error message contains a Windows-style path which does not match the hard-coded path (See TestLoadTrustStoreWithInvalidCerts).

Closed by #58