fix(store/valkey): Redis™ Sentinel doesn't require a password

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2025-11-18 09:16:12 -05:00
parent 6ca74c65bd
commit 156502b3db
3 changed files with 3 additions and 8 deletions

View File

@@ -24,7 +24,6 @@ var (
// Sentinel validation errors
ErrSentinelMasterNameRequired = errors.New("valkey.Sentinel: masterName is required")
ErrSentinelAddrRequired = errors.New("valkey.Sentinel: addr is required")
ErrSentinelPasswordRequired = errors.New("valkey.Sentinel: password is required")
ErrSentinelAddrEmpty = errors.New("valkey.Sentinel: addr cannot be empty")
)
@@ -68,7 +67,7 @@ type Sentinel struct {
Addr internal.ListOr[string] `json:"addr"`
ClientName string `json:"clientName,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password"`
Password string `json:"password,omitempty"`
}
func (s Sentinel) Valid() error {
@@ -94,10 +93,6 @@ func (s Sentinel) Valid() error {
}
}
if s.Password == "" {
errs = append(errs, ErrSentinelPasswordRequired)
}
if len(errs) > 0 {
return errors.Join(errs...)
}

View File

@@ -91,7 +91,7 @@ func TestFactoryValid(t *testing.T) {
{
name: "sentinel missing password",
jsonData: `{"sentinel": {"masterName": "mymaster", "addr": ["localhost:26379"]}}`,
expectError: ErrSentinelPasswordRequired,
expectError: nil,
},
{
name: "sentinel with optional fields",