configurable for load and stat statistics logs (#980)
This commit is contained in:
@@ -2,6 +2,7 @@ package load
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -22,3 +23,32 @@ func TestSheddingStat(t *testing.T) {
|
||||
assert.Equal(t, int64(5), result.Pass)
|
||||
assert.Equal(t, int64(7), result.Drop)
|
||||
}
|
||||
|
||||
func TestLoopTrue(t *testing.T) {
|
||||
ch := make(chan time.Time, 1)
|
||||
ch <- time.Now()
|
||||
close(ch)
|
||||
st := new(SheddingStat)
|
||||
logEnabled.Set(true)
|
||||
st.loop(ch)
|
||||
}
|
||||
|
||||
func TestLoopTrueAndDrop(t *testing.T) {
|
||||
ch := make(chan time.Time, 1)
|
||||
ch <- time.Now()
|
||||
close(ch)
|
||||
st := new(SheddingStat)
|
||||
st.IncrementDrop()
|
||||
logEnabled.Set(true)
|
||||
st.loop(ch)
|
||||
}
|
||||
|
||||
func TestLoopFalseAndDrop(t *testing.T) {
|
||||
ch := make(chan time.Time, 1)
|
||||
ch <- time.Now()
|
||||
close(ch)
|
||||
st := new(SheddingStat)
|
||||
st.IncrementDrop()
|
||||
logEnabled.Set(false)
|
||||
st.loop(ch)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user