1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Allowing for running tests on a port other than the fixed 6380 (#2466)

* Allowing for redis on a specified port

* updating the readme

---------

Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: Monkey <golang@88.com>
This commit is contained in:
Chayim
2023-03-06 15:31:39 +02:00
committed by GitHub
parent ad89a97fdc
commit cbfe6cd076
3 changed files with 16 additions and 3 deletions

View File

@ -17,8 +17,6 @@ import (
)
const (
redisPort = "6380"
redisAddr = ":" + redisPort
redisSecondaryPort = "6381"
)
@ -38,6 +36,9 @@ const (
sentinelPort3 = "9128"
)
var redisPort = "6380"
var redisAddr = ":" + redisPort
var (
sentinelAddrs = []string{":" + sentinelPort1, ":" + sentinelPort2, ":" + sentinelPort3}
@ -64,6 +65,11 @@ func registerProcess(port string, p *redisProcess) {
}
var _ = BeforeSuite(func() {
addr := os.Getenv("REDIS_PORT")
if addr != "" {
redisPort = addr
redisAddr = ":" + redisPort
}
var err error
redisMain, err = startRedis(redisPort)