This commit is contained in:
Vladimir Mihailenco 2021-02-25 17:58:15 +02:00
parent 00eeb1cb09
commit 491b007809
1 changed files with 10 additions and 3 deletions

View File

@ -5,7 +5,8 @@
[![Documentation](https://img.shields.io/badge/redis-documentation-informational)](https://redis.uptrace.dev/) [![Documentation](https://img.shields.io/badge/redis-documentation-informational)](https://redis.uptrace.dev/)
[![Chat](https://discordapp.com/api/guilds/752070105847955518/widget.png)](https://discord.gg/rWtp5Aj) [![Chat](https://discordapp.com/api/guilds/752070105847955518/widget.png)](https://discord.gg/rWtp5Aj)
> :heart: [**Uptrace.dev** - distributed traces, logs, and errors in one place](https://uptrace.dev) > :heart:
> [**Uptrace.dev** - distributed traces, logs, and errors in one place](https://uptrace.dev?utm_source=gh-redis&utm_campaign=gh-redis-var1)
- Join [Discord](https://discord.gg/rWtp5Aj) to ask questions. - Join [Discord](https://discord.gg/rWtp5Aj) to ask questions.
- [Documentation](https://redis.uptrace.dev) - [Documentation](https://redis.uptrace.dev)
@ -129,10 +130,13 @@ vals, err := rdb.Eval(ctx, "return {KEYS[1],ARGV[1]}", []string{"key"}, "hello")
// custom command // custom command
res, err := rdb.Do(ctx, "set", "key", "value").Result() res, err := rdb.Do(ctx, "set", "key", "value").Result()
``` ```
## Run the test ## Run the test
go-redis will start a redis-server and run the test cases. 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`: The paths of redis-server bin file and redis config file are definded in `main_test.go`:
``` ```
var ( var (
redisServerBin, _ = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server")) redisServerBin, _ = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server"))
@ -140,13 +144,16 @@ var (
) )
``` ```
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/`: 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 ln -s /usr/bin/redis-server ./go-redis/testdata/redis/src
cp ./go-redis/testdata/redis.conf ./go-redis/testdata/redis/ cp ./go-redis/testdata/redis.conf ./go-redis/testdata/redis/
``` ```
Lastly, run: Lastly, run:
``` ```
go test go test
``` ```