From 1f4532d5826dda767860f4a89c482dc30543e1bf Mon Sep 17 00:00:00 2001 From: Yuxuan Li Date: Fri, 9 Nov 2018 15:46:25 -0800 Subject: [PATCH] update test to be comparing the channelz cipher suite with all avaialble cipher suites --- test/channelz_test.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/test/channelz_test.go b/test/channelz_test.go index c614ee56872b..ae2a23167887 100644 --- a/test/channelz_test.go +++ b/test/channelz_test.go @@ -1232,19 +1232,16 @@ func TestCZSocketGetSecurityValueTLS(t *testing.T) { } skt := channelz.GetSocket(id) cert, _ := tls.LoadX509KeyPair(testdata.Path("server1.pem"), testdata.Path("server1.key")) - conn, err := tls.Dial("tcp", te.srvAddr, &tls.Config{Certificates: []tls.Certificate{cert}}) - if err != nil { - return false, fmt.Errorf("tls.Dial failed due to err: %v", err) - } securityVal := skt.SocketData.Security.(*credentials.TLSChannelzSecurityValue) - if credentials.CipherSuiteLookup[conn.ConnectionState().CipherSuite] != securityVal.StandardName { - return false, fmt.Errorf("SocketData.Security.StandardName got: %v, want: %v", securityVal.StandardName, credentials.CipherSuiteLookup[conn.ConnectionState().CipherSuite]) - } if !reflect.DeepEqual(securityVal.RemoteCertificate, cert.Certificate[0]) { return false, fmt.Errorf("SocketData.Security.RemoteCertificate got: %v, want: %v", securityVal.RemoteCertificate, cert.Certificate[0]) } - - return true, nil + for _, v := range credentials.CipherSuiteLookup { + if v == securityVal.StandardName { + return true, nil + } + } + return false, fmt.Errorf("SocketData.Security.StandardName got: %v, want it to be one of %v ", securityVal.StandardName, credentials.CipherSuiteLookup) }); err != nil { t.Fatal(err) }