-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple TestServerBehaviour tests fail with Go 1.21 #187
Comments
I think this is the same as #171. |
All tests pass successfully when tested with Go 1.20.8. |
Yea, I noticed that in #183. |
@SuperQ I'll take a look at refactoring the tests as I described in #171 (comment) and submit a PR. |
The code responsible for the change in behaviour in Go 1.21 is in the chains, err := certs[0].Verify(opts)
if err != nil {
var errCertificateInvalid x509.CertificateInvalidError
if errors.As(err, &x509.UnknownAuthorityError{}) {
c.sendAlert(alertUnknownCA)
} else if errors.As(err, &errCertificateInvalid) && errCertificateInvalid.Reason == x509.Expired {
c.sendAlert(alertCertificateExpired)
} else {
c.sendAlert(alertBadCertificate)
}
return &CertificateVerificationError{UnverifiedCertificates: certs, Err: err}
} ... compared to the more simplistic error handling in Go 1.20: chains, err := certs[0].Verify(opts)
if err != nil {
c.sendAlert(alertBadCertificate)
return &CertificateVerificationError{UnverifiedCertificates: certs, Err: err}
} In theory, we should be able to use
Unwrapping that we get I haven't dug deep enough yet to see whether the actual test code is somehow munging the original |
A little more investigation reveals that these errors are originating from
So the I'm not sure there is much we can do to improve this, other than implement Go version-specific error message patterns to match in the tests. |
Go 1.21 introduced more granular / specific error strings for certain "bad certificate" scenarios[1]. As such, we need to split these tests and conditionally compile based on build tags. Fixes: prometheus#171, prometheus#187 [1]: golang/go@62a9948 Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
* Split TLS client tests to handle Go 1.21+ error strings Go 1.21 introduced more granular / specific error strings for certain "bad certificate" scenarios[1]. As such, we need to split these tests and conditionally compile based on build tags. Fixes: #171, #187 [1]: golang/go@62a9948 --------- Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com> Co-authored-by: Ben Kochie <superq@gmail.com>
Closed via #188 |
Tested latest tag v0.11.0 with Go 1.21.1 on Ubuntu 23.10, and Go 1.21.5 on Debian sid.
The text was updated successfully, but these errors were encountered: