refactor(redistest): simplify redistest.CreateRedis API (#3086)

This commit is contained in:
cong
2023-04-01 13:02:21 +08:00
committed by GitHub
parent 6a692453dc
commit b49fc81618
9 changed files with 72 additions and 156 deletions

View File

@@ -33,9 +33,7 @@ func TestPeriodLimit_RedisUnavailable(t *testing.T) {
}
func testPeriodLimit(t *testing.T, opts ...PeriodOption) {
store, clean, err := redistest.CreateRedis()
assert.Nil(t, err)
defer clean()
store := redistest.CreateRedis(t)
const (
seconds = 1

View File

@@ -70,9 +70,7 @@ func TestTokenLimit_Rescue(t *testing.T) {
}
func TestTokenLimit_Take(t *testing.T) {
store, clean, err := redistest.CreateRedis()
assert.Nil(t, err)
defer clean()
store := redistest.CreateRedis(t)
const (
total = 100
@@ -92,9 +90,7 @@ func TestTokenLimit_Take(t *testing.T) {
}
func TestTokenLimit_TakeBurst(t *testing.T) {
store, clean, err := redistest.CreateRedis()
assert.Nil(t, err)
defer clean()
store := redistest.CreateRedis(t)
const (
total = 100