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.
25 lines
367 B
Go
25 lines
367 B
Go
//go:build linux
|
|
|
|
package stat
|
|
|
|
import (
|
|
"strconv"
|
|
"sync/atomic"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestReport(t *testing.T) {
|
|
t.Setenv(clusterNameKey, "test-cluster")
|
|
|
|
var count int32
|
|
SetReporter(func(s string) {
|
|
atomic.AddInt32(&count, 1)
|
|
})
|
|
for i := 0; i < 10; i++ {
|
|
Report(strconv.Itoa(i))
|
|
}
|
|
assert.Equal(t, int32(1), count)
|
|
}
|