Skip to content

Commit 8b455de

Browse files
authored
removing Roots deprecated Subjects field in tests (#6907)
1 parent 953d12a commit 8b455de

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

Diff for: credentials/tls/certprovider/pemfile/watcher_test.go

+2-9
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import (
2626
"testing"
2727
"time"
2828

29-
"github.com/google/go-cmp/cmp"
30-
"github.com/google/go-cmp/cmp/cmpopts"
3129
"google.golang.org/grpc/credentials/tls/certprovider"
3230
"google.golang.org/grpc/internal/grpctest"
3331
"google.golang.org/grpc/internal/testutils"
@@ -63,15 +61,10 @@ func compareKeyMaterial(got, want *certprovider.KeyMaterial) error {
6361
}
6462
}
6563

66-
// x509.CertPool contains only unexported fields some of which contain other
67-
// unexported fields. So usage of cmp.AllowUnexported() or
68-
// cmpopts.IgnoreUnexported() does not help us much here. Also, the standard
69-
// library does not provide a way to compare CertPool values. Comparing the
70-
// subjects field of the certs in the CertPool seems like a reasonable
71-
// approach.
72-
if gotR, wantR := got.Roots.Subjects(), want.Roots.Subjects(); !cmp.Equal(gotR, wantR, cmpopts.EquateEmpty()) {
64+
if gotR, wantR := got.Roots, want.Roots; !gotR.Equal(wantR) {
7365
return fmt.Errorf("keyMaterial roots = %v, want %v", gotR, wantR)
7466
}
67+
7568
return nil
7669
}
7770

Diff for: credentials/tls/certprovider/store_test.go

+2-9
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import (
2828
"testing"
2929
"time"
3030

31-
"github.com/google/go-cmp/cmp"
32-
"github.com/google/go-cmp/cmp/cmpopts"
3331
"google.golang.org/grpc/internal/grpctest"
3432
"google.golang.org/grpc/internal/testutils"
3533
"google.golang.org/grpc/testdata"
@@ -162,15 +160,10 @@ func compareKeyMaterial(got, want *KeyMaterial) error {
162160
}
163161
}
164162

165-
// x509.CertPool contains only unexported fields some of which contain other
166-
// unexported fields. So usage of cmp.AllowUnexported() or
167-
// cmpopts.IgnoreUnexported() does not help us much here. Also, the standard
168-
// library does not provide a way to compare CertPool values. Comparing the
169-
// subjects field of the certs in the CertPool seems like a reasonable
170-
// approach.
171-
if gotR, wantR := got.Roots.Subjects(), want.Roots.Subjects(); !cmp.Equal(gotR, wantR, cmpopts.EquateEmpty()) {
163+
if gotR, wantR := got.Roots, want.Roots; !gotR.Equal(wantR) {
172164
return fmt.Errorf("keyMaterial roots = %v, want %v", gotR, wantR)
173165
}
166+
174167
return nil
175168
}
176169

Diff for: vet.sh

-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ GetSafeRegexMatch
185185
GetSuffixMatch
186186
GetTlsCertificateCertificateProviderInstance
187187
GetValidationContextCertificateProviderInstance
188-
XXXXX TODO: Remove the below deprecation usages:
189-
Roots.Subjects
190188
XXXXX PleaseIgnoreUnused'
191189

192190
echo SUCCESS

0 commit comments

Comments
 (0)