Test_ExponentialBackoff_Next() — fiber Function Reference
Architecture documentation for the Test_ExponentialBackoff_Next() function in exponential_backoff_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 31b2a86e_93e4_d018_2a5a_a7b9470283de["Test_ExponentialBackoff_Next()"] 06704709_6b3e_c36a_84b3_c50264ae004e["exponential_backoff_test.go"] 31b2a86e_93e4_d018_2a5a_a7b9470283de -->|defined in| 06704709_6b3e_c36a_84b3_c50264ae004e style 31b2a86e_93e4_d018_2a5a_a7b9470283de fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
addon/retry/exponential_backoff_test.go lines 88–147
func Test_ExponentialBackoff_Next(t *testing.T) {
t.Parallel()
tests := []struct {
name string
expBackoff *ExponentialBackoff
expNextTimeIntervals []time.Duration
}{
{
name: "With default values",
expBackoff: NewExponentialBackoff(),
expNextTimeIntervals: []time.Duration{
1 * time.Second,
2 * time.Second,
4 * time.Second,
8 * time.Second,
16 * time.Second,
32 * time.Second,
32 * time.Second,
32 * time.Second,
32 * time.Second,
32 * time.Second,
},
},
{
name: "Custom values",
expBackoff: &ExponentialBackoff{
InitialInterval: 2.0 * time.Second,
MaxBackoffTime: 64 * time.Second,
Multiplier: 3.0,
MaxRetryCount: 8,
currentInterval: 2.0 * time.Second,
},
expNextTimeIntervals: []time.Duration{
2 * time.Second,
6 * time.Second,
18 * time.Second,
54 * time.Second,
64 * time.Second,
64 * time.Second,
64 * time.Second,
64 * time.Second,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
for i := range tt.expBackoff.MaxRetryCount {
next := tt.expBackoff.next()
if next < tt.expNextTimeIntervals[i] || next > tt.expNextTimeIntervals[i]+1*time.Second {
t.Errorf("wrong next time:\n"+
"actual:%v\n"+
"expected range:%v-%v\n",
next, tt.expNextTimeIntervals[i], tt.expNextTimeIntervals[i]+1*time.Second)
}
}
})
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_ExponentialBackoff_Next() do?
Test_ExponentialBackoff_Next() is a function in the fiber codebase, defined in addon/retry/exponential_backoff_test.go.
Where is Test_ExponentialBackoff_Next() defined?
Test_ExponentialBackoff_Next() is defined in addon/retry/exponential_backoff_test.go at line 88.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free