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

Function testBackoffConfigSet

clientconn_test.go:427–447  ·  view source on GitHub ↗
(t *testing.T, wantBackoff internalbackoff.Exponential, opts ...DialOption)

Source from the content-addressed store, hash-verified

425}
426
427func testBackoffConfigSet(t *testing.T, wantBackoff internalbackoff.Exponential, opts ...DialOption) {
428 opts = append(opts, WithTransportCredentials(insecure.NewCredentials()))
429 conn, err := NewClient("passthrough:///foo:80", opts...)
430 if err != nil {
431 t.Fatalf("grpc.NewClient() failed: %v", err)
432 }
433 defer conn.Close()
434
435 if conn.dopts.bs == nil {
436 t.Fatalf("backoff config not set")
437 }
438
439 gotBackoff, ok := conn.dopts.bs.(internalbackoff.Exponential)
440 if !ok {
441 t.Fatalf("unexpected type of backoff config: %#v", conn.dopts.bs)
442 }
443
444 if gotBackoff != wantBackoff {
445 t.Fatalf("unexpected backoff config on connection: %v, want %v", gotBackoff, wantBackoff)
446 }
447}
448
449func (s) TestConnectParamsWithMinConnectTimeout(t *testing.T) {
450 // Default value specified for minConnectTimeout in the spec is 20 seconds.

Callers 4

TestWithBackoffConfigMethod · 0.85
TestWithConnectParamsMethod · 0.85

Calls 5

NewCredentialsFunction · 0.92
WithTransportCredentialsFunction · 0.85
NewClientFunction · 0.70
FatalfMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected