github.com/msales/pkg/v3@v3.24.0/breaker/breaker_internal_test.go (about)

     1  package breaker
     2  
     3  import (
     4  	"testing"
     5  	"time"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestWithSleep(t *testing.T) {
    11  	b := &Breaker{}
    12  
    13  	f := WithSleep(time.Millisecond)
    14  	f(b)
    15  
    16  	assert.Equal(t, time.Millisecond, b.sleep)
    17  }
    18  
    19  func TestWithTestRequests(t *testing.T) {
    20  	b := &Breaker{}
    21  
    22  	f := WithTestRequests(10)
    23  	f(b)
    24  
    25  	assert.Equal(t, uint64(10), b.testRequests)
    26  }