MCPcopy
hub / github.com/grpc/grpc-go / readAndVerifyKeyMaterial

Function readAndVerifyKeyMaterial

credentials/tls/certprovider/store_test.go:145–151  ·  view source on GitHub ↗

readAndVerifyKeyMaterial attempts to read key material from the given provider and compares it against the expected key material.

(ctx context.Context, kmr kmReader, wantKM *KeyMaterial)

Source from the content-addressed store, hash-verified

143// readAndVerifyKeyMaterial attempts to read key material from the given
144// provider and compares it against the expected key material.
145func readAndVerifyKeyMaterial(ctx context.Context, kmr kmReader, wantKM *KeyMaterial) error {
146 gotKM, err := kmr.KeyMaterial(ctx)
147 if err != nil {
148 return fmt.Errorf("KeyMaterial(ctx) failed: %w", err)
149 }
150 return compareKeyMaterial(gotKM, wantKM)
151}
152
153func compareKeyMaterial(got, want *KeyMaterial) error {
154 if len(got.Certs) != len(want.Certs) {

Calls 3

compareKeyMaterialFunction · 0.70
KeyMaterialMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected