You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/core/load/nopshedder_test.go

22 lines
308 B
Go

4 years ago
package load
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNopShedder(t *testing.T) {
Disable()
shedder := NewAdaptiveShedder()
for i := 0; i < 1000; i++ {
p, err := shedder.Allow()
assert.Nil(t, err)
p.Fail()
}
p, err := shedder.Allow()
assert.Nil(t, err)
p.Pass()
}