mirror of https://github.com/go-redis/redis.git
Added test setup document in README.md (#1585)
* Added test setup document in README.md * Fixed typo
This commit is contained in:
parent
143859e345
commit
72e5988b6e
21
README.md
21
README.md
|
@ -129,6 +129,27 @@ vals, err := rdb.Eval(ctx, "return {KEYS[1],ARGV[1]}", []string{"key"}, "hello")
|
|||
// custom command
|
||||
res, err := rdb.Do(ctx, "set", "key", "value").Result()
|
||||
```
|
||||
## Run the test
|
||||
go-redis will start a redis-server and run the test cases.
|
||||
|
||||
The paths of redis-server bin file and redis config file are definded in `main_test.go`:
|
||||
```
|
||||
var (
|
||||
redisServerBin, _ = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server"))
|
||||
redisServerConf, _ = filepath.Abs(filepath.Join("testdata", "redis", "redis.conf"))
|
||||
)
|
||||
```
|
||||
|
||||
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/`:
|
||||
```
|
||||
ln -s /usr/bin/redis-server ./go-redis/testdata/redis/src
|
||||
cp ./go-redis/testdata/redis.conf ./go-redis/testdata/redis/
|
||||
```
|
||||
|
||||
Lastly, run:
|
||||
```
|
||||
go test
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
|
|
Loading…
Reference in New Issue