Skip to content

Commit

Permalink
ignore redis env test
Browse files Browse the repository at this point in the history
  • Loading branch information
yinheli committed Jul 7, 2021
1 parent 4ecc62b commit 9d1eb19
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/redisx/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ package redisx

import (
"context"
"os"
"testing"

"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
)

func newViper() *viper.Viper {
func newViper(t *testing.T) *viper.Viper {
if os.Getenv("REDIS_TEST") == "" {
t.Skip("skip redis test")
}
v := viper.New()
v.SetDefault("redis", map[string]interface{}{
"name": "redis",
Expand All @@ -20,14 +24,14 @@ func newViper() *viper.Viper {
}

func Test_config(t *testing.T) {
v := newViper()
v := newViper(t)
Config(v)
assert.NotNil(t, Get("redis"))
assert.NotNil(t, Locker)
}

func Test_wrapper(t *testing.T) {
v := newViper()
v := newViper(t)
Config(v)

w := Get("redis")
Expand Down

0 comments on commit 9d1eb19

Please sign in to comment.