Codebase list golang-github-go-kit-kit / 03649991-3798-4bdc-9a00-4ea873739e14/main circuitbreaker / gobreaker_test.go
03649991-3798-4bdc-9a00-4ea873739e14/main

Tree @03649991-3798-4bdc-9a00-4ea873739e14/main (Download .tar.gz)

gobreaker_test.go @03649991-3798-4bdc-9a00-4ea873739e14/main

2cddaa7
 
 
 
 
 
 
 
 
 
569b930
2cddaa7
4a67d58
8317f15
 
 
2cddaa7
e8ced30
2cddaa7
package circuitbreaker_test

import (
	"testing"

	"github.com/sony/gobreaker"

	"github.com/go-kit/kit/circuitbreaker"
)

func TestGobreaker(t *testing.T) {
	var (
		breaker          = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{}))
		primeWith        = 100
		shouldPass       = func(n int) bool { return n <= 5 } // https://github.com/sony/gobreaker/blob/bfa846d/gobreaker.go#L76
		circuitOpenError = "circuit breaker is open"
	)
	testFailingEndpoint(t, breaker, primeWith, shouldPass, 0, circuitOpenError)
}