@@ -17,6 +17,7 @@ limitations under the License.
1717package certwatcher_test
1818
1919import (
20+ "bytes"
2021 "context"
2122 "crypto/rand"
2223 "crypto/rsa"
@@ -114,7 +115,7 @@ var _ = Describe("CertWatcher", func() {
114115 Eventually (func () bool {
115116 secondcert , _ := watcher .GetCertificate (nil )
116117 first := firstcert .PrivateKey .(* rsa.PrivateKey )
117- return first .Equal (secondcert .PrivateKey ) || firstcert .Leaf . SerialNumber == secondcert .Leaf . SerialNumber
118+ return first .Equal (secondcert .PrivateKey ) || bytes . Equal ( firstcert .Certificate [ 0 ], secondcert .Certificate [ 0 ])
118119 }).ShouldNot (BeTrue ())
119120
120121 ctxCancel ()
@@ -144,7 +145,7 @@ var _ = Describe("CertWatcher", func() {
144145 Eventually (func () bool {
145146 secondcert , _ := watcher .GetCertificate (nil )
146147 first := firstcert .PrivateKey .(* rsa.PrivateKey )
147- return first .Equal (secondcert .PrivateKey ) || firstcert .Leaf . SerialNumber == secondcert .Leaf . SerialNumber
148+ return first .Equal (secondcert .PrivateKey ) || bytes . Equal ( firstcert .Certificate [ 0 ], secondcert .Certificate [ 0 ])
148149 }).ShouldNot (BeTrue ())
149150
150151 ctxCancel ()
@@ -171,7 +172,7 @@ var _ = Describe("CertWatcher", func() {
171172 Eventually (func () bool {
172173 secondcert , _ := watcher .GetCertificate (nil )
173174 first := firstcert .PrivateKey .(* rsa.PrivateKey )
174- return first .Equal (secondcert .PrivateKey ) || firstcert .Leaf . SerialNumber == secondcert .Leaf . SerialNumber
175+ return first .Equal (secondcert .PrivateKey ) || bytes . Equal ( firstcert .Certificate [ 0 ], secondcert .Certificate [ 0 ])
175176 }, "10s" , "1s" ).ShouldNot (BeTrue ())
176177
177178 ctxCancel ()
0 commit comments