diff --git a/cmd/asynqmon/main.go b/cmd/asynqmon/main.go index efc0f1d..ba5fdaf 100644 --- a/cmd/asynqmon/main.go +++ b/cmd/asynqmon/main.go @@ -109,6 +109,8 @@ func makeRedisConnOpt(cfg *Config) (asynq.RedisConnOpt, error) { } connOpt := res.(asynq.RedisFailoverClientOpt) // safe to type-assert connOpt.TLSConfig = makeTLSConfig(cfg) + connOpt.SentinelPassword = connOpt.Password // password from asynq.ParseRedisURI should be used for sentinel + connOpt.Password = cfg.RedisPassword // override parsed password with value from config return connOpt, nil } diff --git a/cmd/asynqmon/main_test.go b/cmd/asynqmon/main_test.go index 6d70082..956ffa4 100644 --- a/cmd/asynqmon/main_test.go +++ b/cmd/asynqmon/main_test.go @@ -100,13 +100,27 @@ func TestMakeRedisConnOpt(t *testing.T) { { desc: "With redis-sentinel URL", cfg: &Config{ - RedisURL: "redis-sentinel://:secretpassword@localhost:5000,localhost:5001,localhost:5002?master=mymaster", + RedisURL: "redis-sentinel://:sentinelpassword@localhost:5000,localhost:5001,localhost:5002?master=mymaster", }, want: asynq.RedisFailoverClientOpt{ MasterName: "mymaster", SentinelAddrs: []string{ "localhost:5000", "localhost:5001", "localhost:5002"}, - Password: "secretpassword", // FIXME: Shouldn't this be SentinelPassword instead? + SentinelPassword: "sentinelpassword", + }, + }, + { + desc: "With redis-sentinel URL and password", + cfg: &Config{ + RedisURL: "redis-sentinel://:sentinelpassword@localhost:5000,localhost:5001,localhost:5002?master=mymaster", + RedisPassword: "redispassword", + }, + want: asynq.RedisFailoverClientOpt{ + MasterName: "mymaster", + SentinelAddrs: []string{ + "localhost:5000", "localhost:5001", "localhost:5002"}, + SentinelPassword: "sentinelpassword", + Password: "redispassword", }, }, {