mirror of https://github.com/grpc/grpc-go.git
removing Roots deprecated Subjects field in tests (#6907)
This commit is contained in:
parent
953d12a1c6
commit
8b455deef5
|
@ -26,8 +26,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"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/credentials/tls/certprovider"
|
||||||
"google.golang.org/grpc/internal/grpctest"
|
"google.golang.org/grpc/internal/grpctest"
|
||||||
"google.golang.org/grpc/internal/testutils"
|
"google.golang.org/grpc/internal/testutils"
|
||||||
|
@ -63,15 +61,10 @@ func compareKeyMaterial(got, want *certprovider.KeyMaterial) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// x509.CertPool contains only unexported fields some of which contain other
|
if gotR, wantR := got.Roots, want.Roots; !gotR.Equal(wantR) {
|
||||||
// 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()) {
|
|
||||||
return fmt.Errorf("keyMaterial roots = %v, want %v", gotR, wantR)
|
return fmt.Errorf("keyMaterial roots = %v, want %v", gotR, wantR)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"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/grpctest"
|
||||||
"google.golang.org/grpc/internal/testutils"
|
"google.golang.org/grpc/internal/testutils"
|
||||||
"google.golang.org/grpc/testdata"
|
"google.golang.org/grpc/testdata"
|
||||||
|
@ -162,15 +160,10 @@ func compareKeyMaterial(got, want *KeyMaterial) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// x509.CertPool contains only unexported fields some of which contain other
|
if gotR, wantR := got.Roots, want.Roots; !gotR.Equal(wantR) {
|
||||||
// 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()) {
|
|
||||||
return fmt.Errorf("keyMaterial roots = %v, want %v", gotR, wantR)
|
return fmt.Errorf("keyMaterial roots = %v, want %v", gotR, wantR)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
vet.sh
2
vet.sh
|
@ -185,8 +185,6 @@ GetSafeRegexMatch
|
||||||
GetSuffixMatch
|
GetSuffixMatch
|
||||||
GetTlsCertificateCertificateProviderInstance
|
GetTlsCertificateCertificateProviderInstance
|
||||||
GetValidationContextCertificateProviderInstance
|
GetValidationContextCertificateProviderInstance
|
||||||
XXXXX TODO: Remove the below deprecation usages:
|
|
||||||
Roots.Subjects
|
|
||||||
XXXXX PleaseIgnoreUnused'
|
XXXXX PleaseIgnoreUnused'
|
||||||
|
|
||||||
echo SUCCESS
|
echo SUCCESS
|
||||||
|
|
Loading…
Reference in New Issue