Skip to content

Commit 4d21199

Browse files
committed
fix test
1 parent 3a2b3da commit 4d21199

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

db_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"math/rand"
99
"os"
1010
"path/filepath"
11+
"runtime"
1112
"testing"
1213
"time"
1314
)
@@ -69,6 +70,9 @@ func TestLogFileGC(t *testing.T) {
6970
func destroyDB(db *RoseDB) {
7071
if db != nil {
7172
_ = db.Close()
73+
if runtime.GOOS == "windows" {
74+
time.Sleep(time.Millisecond * 100)
75+
}
7276
err := os.RemoveAll(db.opts.DBPath)
7377
if err != nil {
7478
logger.Errorf("destroy db err: %v", err)

strs.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package rosedb
22

33
import (
44
"bytes"
5-
"encoding/binary"
65
"errors"
76
"github.com/flower-corp/rosedb/logfile"
87
"github.com/flower-corp/rosedb/logger"
@@ -331,8 +330,7 @@ func (db *RoseDB) StrLen(key []byte) int {
331330
if err != nil {
332331
return 0
333332
}
334-
335-
return binary.Size(val)
333+
return len(val)
336334
}
337335

338336
// Count returns the total number of keys of String.

0 commit comments

Comments
 (0)