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

channelz: fix GetSecurityValue function name. #2450

Merged
merged 1 commit into from
Nov 29, 2018

Conversation

lyuxuan
Copy link
Contributor

@lyuxuan lyuxuan commented Nov 10, 2018

No description provided.

}
skt := channelz.GetSocket(id)
cert, _ := tls.LoadX509KeyPair(testdata.Path("server1.pem"), testdata.Path("server1.key"))
securityVal := skt.SocketData.Security.(*credentials.TLSChannelzSecurityValue)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do an ok check to avoid panic is Security is not the expected type.

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

if !reflect.DeepEqual(securityVal.RemoteCertificate, cert.Certificate[0]) {
return false, fmt.Errorf("SocketData.Security.RemoteCertificate got: %v, want: %v", securityVal.RemoteCertificate, cert.Certificate[0])
}
for _, v := range credentials.CipherSuiteLookup {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are the expected suites a subset of the whole CipherSuiteLookup? I would prefer to not export the map for testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

make a test copy of all the cipher suites for checking against.

@thelinuxfoundation
Copy link

Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement.

After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.

Regards,
CLA GitHub bot

te.startServer(&testServer{security: e.security})
defer te.tearDown()
te.clientConn()
if err := verifyResultWithDelay(func() (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to the changes in this PR.

Can this just be verifyResultWithDelay(func() error)? (No bool in return value).
It seems the function either return true, nil or false, <non-nil>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. I think the original idea is that we may want false, nil sometimes to skip creating intermediate errors. But it seems we don't really have such use case yet. We probably should just refactor to what you suggested.

@lyuxuan lyuxuan merged commit ca62c6b into grpc:master Nov 29, 2018
@dfawley dfawley added this to the 1.17 Release milestone Dec 6, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2019
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.

4 participants