Skip to content

Commit 67a46bf

Browse files
committedFeb 3, 2025
fix test suite
1 parent e0e2972 commit 67a46bf

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed
 

‎database/persistence_test.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
package database
22

33
import (
4-
"github.com/hdt3213/godis/aof"
5-
"github.com/hdt3213/godis/config"
6-
"github.com/hdt3213/godis/lib/utils"
7-
"github.com/hdt3213/godis/redis/connection"
8-
"github.com/hdt3213/godis/redis/protocol/asserts"
94
"io/ioutil"
5+
"os"
106
"path/filepath"
117
"runtime"
128
"testing"
139
"time"
10+
11+
"github.com/hdt3213/godis/aof"
12+
"github.com/hdt3213/godis/config"
13+
"github.com/hdt3213/godis/lib/utils"
14+
"github.com/hdt3213/godis/redis/connection"
15+
"github.com/hdt3213/godis/redis/protocol/asserts"
1416
)
1517

1618
func TestLoadRDB(t *testing.T) {
1719
_, b, _, _ := runtime.Caller(0)
1820
projectRoot := filepath.Dir(filepath.Dir(b))
21+
os.Chdir(projectRoot)
1922
config.Properties = &config.ServerProperties{
2023
AppendOnly: false,
21-
RDBFilename: filepath.Join(projectRoot, "test.rdb"), // set working directory to project root
24+
RDBFilename: "test.rdb", // set working directory to project root
2225
}
2326
conn := connection.NewFakeConn()
2427
rdbDB := NewStandaloneServer()
@@ -38,7 +41,7 @@ func TestLoadRDB(t *testing.T) {
3841
// test no rdb file
3942
config.Properties = &config.ServerProperties{
4043
AppendOnly: false,
41-
RDBFilename: filepath.Join(projectRoot, "none", "test.rdb"), // set working directory to project root
44+
RDBFilename: "noexists.rdb",
4245
}
4346
rdbDB = NewStandaloneServer()
4447
result = rdbDB.Exec(conn, utils.ToCmdLine("Get", "str"))

0 commit comments

Comments
 (0)