Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
roseduan committed Jun 16, 2022
1 parent 3a2b3da commit 4d21199
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"math/rand"
"os"
"path/filepath"
"runtime"
"testing"
"time"
)
Expand Down Expand Up @@ -69,6 +70,9 @@ func TestLogFileGC(t *testing.T) {
func destroyDB(db *RoseDB) {
if db != nil {
_ = db.Close()
if runtime.GOOS == "windows" {
time.Sleep(time.Millisecond * 100)
}
err := os.RemoveAll(db.opts.DBPath)
if err != nil {
logger.Errorf("destroy db err: %v", err)
Expand Down
4 changes: 1 addition & 3 deletions strs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rosedb

import (
"bytes"
"encoding/binary"
"errors"
"github.com/flower-corp/rosedb/logfile"
"github.com/flower-corp/rosedb/logger"
Expand Down Expand Up @@ -331,8 +330,7 @@ func (db *RoseDB) StrLen(key []byte) int {
if err != nil {
return 0
}

return binary.Size(val)
return len(val)
}

// Count returns the total number of keys of String.
Expand Down

0 comments on commit 4d21199

Please sign in to comment.