mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
feat: upgrade to Redis 7
This commit is contained in:
17
main_test.go
17
main_test.go
@ -283,8 +283,9 @@ func (p *redisProcess) Close() error {
|
||||
}
|
||||
|
||||
var (
|
||||
redisServerBin, _ = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server"))
|
||||
redisServerConf, _ = filepath.Abs(filepath.Join("testdata", "redis", "redis.conf"))
|
||||
redisServerBin, _ = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server"))
|
||||
redisServerConf, _ = filepath.Abs(filepath.Join("testdata", "redis", "redis.conf"))
|
||||
redisSentinelConf, _ = filepath.Abs(filepath.Join("testdata", "redis", "sentinel.conf"))
|
||||
)
|
||||
|
||||
func redisDir(port string) (string, error) {
|
||||
@ -306,7 +307,8 @@ func startRedis(port string, args ...string) (*redisProcess, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = exec.Command("cp", "-f", redisServerConf, dir).Run(); err != nil {
|
||||
|
||||
if err := exec.Command("cp", "-f", redisServerConf, dir).Run(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -333,7 +335,12 @@ func startSentinel(port, masterName, masterPort string) (*redisProcess, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
process, err := execCmd(redisServerBin, os.DevNull, "--sentinel", "--port", port, "--dir", dir)
|
||||
sentinelConf := filepath.Join(dir, "sentinel.conf")
|
||||
if err := os.WriteFile(sentinelConf, nil, 0o644); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
process, err := execCmd(redisServerBin, sentinelConf, "--sentinel", "--port", port, "--dir", dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -355,7 +362,7 @@ func startSentinel(port, masterName, masterPort string) (*redisProcess, error) {
|
||||
client.Process(ctx, cmd)
|
||||
if err := cmd.Err(); err != nil {
|
||||
process.Kill()
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("%s failed: %w", cmd, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user