Skip to content

Commit 72e5988

Browse files
authored
Added test setup document in README.md (#1585)
* Added test setup document in README.md * Fixed typo
1 parent 143859e commit 72e5988

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,27 @@ vals, err := rdb.Eval(ctx, "return {KEYS[1],ARGV[1]}", []string{"key"}, "hello")
129129
// custom command
130130
res, err := rdb.Do(ctx, "set", "key", "value").Result()
131131
```
132+
## Run the test
133+
go-redis will start a redis-server and run the test cases.
134+
135+
The paths of redis-server bin file and redis config file are definded in `main_test.go`:
136+
```
137+
var (
138+
redisServerBin, _ = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server"))
139+
redisServerConf, _ = filepath.Abs(filepath.Join("testdata", "redis", "redis.conf"))
140+
)
141+
```
142+
143+
For local testing, you can change the variables to refer to your local files, or create a soft link to the corresponding folder for redis-server and copy the config file to `testdata/redis/`:
144+
```
145+
ln -s /usr/bin/redis-server ./go-redis/testdata/redis/src
146+
cp ./go-redis/testdata/redis.conf ./go-redis/testdata/redis/
147+
```
148+
149+
Lastly, run:
150+
```
151+
go test
152+
```
132153

133154
## See also
134155

0 commit comments

Comments
 (0)