mirror of
https://github.com/gofiber/fiber.git
synced 2025-07-15 00:30:37 +00:00
* test(retry): achieve full coverage * Fix lint issue * Update addon/retry/exponential_backoff_test.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update exponential_backoff_test.go --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
34 lines
690 B
Go
34 lines
690 B
Go
package retry
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestConfigDefault_NoConfig(t *testing.T) {
|
|
t.Parallel()
|
|
cfg := configDefault()
|
|
require.Equal(t, DefaultConfig, cfg)
|
|
}
|
|
|
|
func TestConfigDefault_Custom(t *testing.T) {
|
|
t.Parallel()
|
|
custom := Config{
|
|
InitialInterval: 2 * time.Second,
|
|
MaxBackoffTime: 64 * time.Second,
|
|
Multiplier: 3.0,
|
|
MaxRetryCount: 5,
|
|
currentInterval: 2 * time.Second,
|
|
}
|
|
cfg := configDefault(custom)
|
|
require.Equal(t, custom, cfg)
|
|
}
|
|
|
|
func TestConfigDefault_PartialAndNegative(t *testing.T) {
|
|
t.Parallel()
|
|
cfg := configDefault(Config{Multiplier: -1, MaxRetryCount: 0})
|
|
require.Equal(t, DefaultConfig, cfg)
|
|
}
|