
Because most of the fields on `BackoffConfig` are unexported, correctly using the config requires copying from the default. This sets the defaults appropriately and falls back to a default if MaxDelay is negative or zero. Tests are added to ensure that the backoff is set correctly in common use cases. Signedroff-by: Stephen J Day <stephen.day@docker.com> Signed-off-by: Stephen J Day <stephen.day@docker.com>
12 lines
258 B
Go
12 lines
258 B
Go
package grpc
|
|
|
|
import "testing"
|
|
|
|
func TestBackoffConfigDefaults(t *testing.T) {
|
|
b := BackoffConfig{}
|
|
b.setDefaults()
|
|
if b != *DefaultBackoffConfig {
|
|
t.Fatalf("expected BackoffConfig to pickup default parameters: %v != %v", b, *DefaultBackoffConfig)
|
|
}
|
|
}
|