改进单元测试,以便于可以使用go test ../...进行执行

This commit is contained in:
刘祥超
2024-04-14 19:59:56 +08:00
parent 7141add68e
commit 27c61ca0d4
8 changed files with 150 additions and 16 deletions

View File

@@ -4,6 +4,7 @@ package kvstore_test
import (
"github.com/TeaOSLab/EdgeNode/internal/utils/kvstore"
"github.com/TeaOSLab/EdgeNode/internal/utils/testutils"
"github.com/cockroachdb/pebble"
"testing"
)
@@ -38,11 +39,17 @@ func testInspectDB(t *testing.T) {
_ = it.Close()
}()
var isSingleTesting = testutils.IsSingleTesting()
for it.First(); it.Valid(); it.Next() {
valueBytes, valueErr := it.ValueAndErr()
if valueErr != nil {
t.Fatal(valueErr)
}
t.Log(string(it.Key()), "=>", string(valueBytes))
if !isSingleTesting {
break
}
}
}