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

removing Roots deprecated Subjects field in tests #6907

Merged
merged 4 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions credentials/tls/certprovider/pemfile/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import (
"testing"
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"google.golang.org/grpc/credentials/tls/certprovider"
"google.golang.org/grpc/internal/grpctest"
"google.golang.org/grpc/internal/testutils"
Expand Down Expand Up @@ -63,15 +61,10 @@ func compareKeyMaterial(got, want *certprovider.KeyMaterial) error {
}
}

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

return nil
}

Expand Down
11 changes: 2 additions & 9 deletions credentials/tls/certprovider/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
"testing"
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"google.golang.org/grpc/internal/grpctest"
"google.golang.org/grpc/internal/testutils"
"google.golang.org/grpc/testdata"
Expand Down Expand Up @@ -162,15 +160,10 @@ func compareKeyMaterial(got, want *KeyMaterial) error {
}
}

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

return nil
}

Expand Down
2 changes: 0 additions & 2 deletions vet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ GetSafeRegexMatch
GetSuffixMatch
GetTlsCertificateCertificateProviderInstance
GetValidationContextCertificateProviderInstance
XXXXX TODO: Remove the below deprecation usages:
Roots.Subjects
XXXXX PleaseIgnoreUnused'

echo SUCCESS
Loading