MCPcopy
hub / github.com/docker/docker-agent / TestBackoff_Defaults

Function TestBackoff_Defaults

pkg/tools/lifecycle/supervisor_test.go:752–766  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

750}
751
752func TestBackoff_Defaults(t *testing.T) {
753 t.Parallel()
754
755 b := lifecycle.Backoff{}
756 d0 := lifecycle.ExportedBackoffDelay(b, 0, func() float64 { return 0 })
757 d1 := lifecycle.ExportedBackoffDelay(b, 1, func() float64 { return 0 })
758 d2 := lifecycle.ExportedBackoffDelay(b, 2, func() float64 { return 0 })
759 d6 := lifecycle.ExportedBackoffDelay(b, 6, func() float64 { return 0 })
760
761 assert.Check(t, is.Equal(d0, time.Second))
762 assert.Check(t, is.Equal(d1, 2*time.Second))
763 assert.Check(t, is.Equal(d2, 4*time.Second))
764 // 1<<6 = 64s, capped to default Max = 32s.
765 assert.Check(t, is.Equal(d6, 32*time.Second))
766}
767
768func TestBackoff_Jitter(t *testing.T) {
769 t.Parallel()

Callers

nothing calls this directly

Calls 2

ExportedBackoffDelayFunction · 0.92
CheckMethod · 0.80

Tested by

no test coverage detected