Skip to content
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

pemfile: Make test happy with Go1.16 #4164

Merged
merged 3 commits into from
Jan 22, 2021
Merged

Conversation

easwars
Copy link
Contributor

@easwars easwars commented Jan 20, 2021

Go1.16 adds a new unexported field to x509.CertPool which causes our
tests to fail because cmp.Equal() isn't happy. This change introduces a
helper function which compares certprovider.KeyMaterial in a way that
makes the test happy with the new Go version.

Fixes #4162

Go1.16 adds a new unexported field to x509.CertPool which causes our
tests to fail because cmp.Equal() isn't happy. This change introduces a
helper function which compares certprovider.KeyMaterial in a way that
makes the test happy with the new Go version.
@@ -55,6 +56,29 @@ func Test(t *testing.T) {
grpctest.RunSubTests(t, s{})
}

func compareKeyMaterial(got, want *certprovider.KeyMaterial) error {
// TODO(easwars): Remove all references to reflect.DeepEqual and use
// cmp.Equal instead. Currently, the later panics because x509.Certificate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "latter"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the comment since I have switched to cmp.Equal() with a nil check.

Comment on lines 62 to 63
// type defines an Equal method, but does not check for nil. This has been
// fixed in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we do a manual check for nil in the meantime, then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@easwars easwars merged commit 2c42474 into grpc:master Jan 22, 2021
@easwars easwars deleted the certprovider_116 branch January 22, 2021 01:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

credentials/tls/certprovider/pemfile:Test/Provider_UpdateFailure_ThenSuccess fails with Go 1.16
3 participants