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

Function TestIDFromCert

internal/credentials/spiffe/spiffe_test.go:202–211  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

200}
201
202func TestIDFromCert(t *testing.T) {
203 cert := loadX509Cert(t, testdata.Path("x509/spiffe_cert.pem"))
204 uri, err := idFromCert(cert)
205 if err != nil {
206 t.Fatalf("idFromCert() failed with err: %v", err)
207 }
208 if uri != nil && uri.String() != wantURI {
209 t.Fatalf("ID not expected, got %s, want %s", uri.String(), wantURI)
210 }
211}
212
213func TestIDFromCertFileFailures(t *testing.T) {
214 certWithNoURIs := loadX509Cert(t, testdata.Path("spiffe/client_spiffe.pem"))

Callers

nothing calls this directly

Calls 5

PathFunction · 0.92
loadX509CertFunction · 0.85
idFromCertFunction · 0.85
FatalfMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected