chore: add more tests (#2547)

This commit is contained in:
Kevin Wan
2022-10-23 10:54:41 +08:00
committed by GitHub
parent 06e4914e41
commit 46e236fef7
4 changed files with 30 additions and 2 deletions

15
core/fs/files_test.go Normal file
View File

@@ -0,0 +1,15 @@
package fs
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCloseOnExec(t *testing.T) {
file := os.NewFile(0, os.DevNull)
assert.NotPanics(t, func() {
CloseOnExec(file)
})
}

View File

@@ -4,6 +4,7 @@
package stat
import (
"os"
"strconv"
"sync/atomic"
"testing"
@@ -12,6 +13,9 @@ import (
)
func TestReport(t *testing.T) {
os.Setenv(clusterNameKey, "test-cluster")
defer os.Unsetenv(clusterNameKey)
var count int32
SetReporter(func(s string) {
atomic.AddInt32(&count, 1)