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

Method TestClientClone

credentials/xds/xds_client_test.go:662–675  ·  view source on GitHub ↗

TestClientClone verifies the Clone() method on client credentials.

(t *testing.T)

Source from the content-addressed store, hash-verified

660
661// TestClientClone verifies the Clone() method on client credentials.
662func (s) TestClientClone(t *testing.T) {
663 opts := ClientOptions{FallbackCreds: makeFallbackClientCreds(t)}
664 orig, err := NewClientCredentials(opts)
665 if err != nil {
666 t.Fatalf("NewClientCredentials(%v) failed: %v", opts, err)
667 }
668
669 // The credsImpl does not have any exported fields, and it does not make
670 // sense to use any cmp options to look deep into. So, all we make sure here
671 // is that the cloned object points to a different location in memory.
672 if clone := orig.Clone(); clone == orig {
673 t.Fatal("return value from Clone() doesn't point to new credentials instance")
674 }
675}

Callers

nothing calls this directly

Calls 5

makeFallbackClientCredsFunction · 0.85
NewClientCredentialsFunction · 0.85
FatalfMethod · 0.65
CloneMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected