Home / Function/ Test_ExponentialBackoff_NextRandFailure() — fiber Function Reference

Test_ExponentialBackoff_NextRandFailure() — fiber Function Reference

Architecture documentation for the Test_ExponentialBackoff_NextRandFailure() function in exponential_backoff_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  423f5340_7963_0c1d_7520_02129a17c9cb["Test_ExponentialBackoff_NextRandFailure()"]
  06704709_6b3e_c36a_84b3_c50264ae004e["exponential_backoff_test.go"]
  423f5340_7963_0c1d_7520_02129a17c9cb -->|defined in| 06704709_6b3e_c36a_84b3_c50264ae004e
  style 423f5340_7963_0c1d_7520_02129a17c9cb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

addon/retry/exponential_backoff_test.go lines 149–166

func Test_ExponentialBackoff_NextRandFailure(t *testing.T) {
	// Backup original reader and restore at the end
	original := rand.Reader
	defer func() { rand.Reader = original }()
	rand.Reader = failingReader{}

	expBackoff := &ExponentialBackoff{
		InitialInterval: 1 * time.Second,
		MaxBackoffTime:  10 * time.Second,
		Multiplier:      2,
		MaxRetryCount:   3,
		currentInterval: 1 * time.Second,
	}
	next := expBackoff.next()
	require.Equal(t, expBackoff.MaxBackoffTime, next)
	// currentInterval should not change when random fails
	require.Equal(t, 1*time.Second, expBackoff.currentInterval)
}

Domain

Subdomains

Frequently Asked Questions

What does Test_ExponentialBackoff_NextRandFailure() do?
Test_ExponentialBackoff_NextRandFailure() is a function in the fiber codebase, defined in addon/retry/exponential_backoff_test.go.
Where is Test_ExponentialBackoff_NextRandFailure() defined?
Test_ExponentialBackoff_NextRandFailure() is defined in addon/retry/exponential_backoff_test.go at line 149.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free