Accept both old and new cert error strings on MacOS in test assertions #1389
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some unit tests started to fail on MacOS when we started using Go 1.19.5. The Go toolchain on MacOS had a different error message for invalid certs starting in Go 1.18.1, and until it was fixed in Go 1.19.5.
Accept both old and new cert error strings on MacOS in test assertions. Adjust the tests so that they don't care which error message is returned when they are making assertions about error messages.
Also used this as an opportunity to refactor how some tests were making assertions about error strings. New test helpers make it easy for an error string to be expected as an exact string, as a string built using sprintf, as a regexp, or as a string built to include the platform-specific x509 error string. All of these test helpers can be used in a single
wantErr
field of a test table. They can be used for both unit tests and integration tests.Release note: