Skip to content

Commit 5188919

Browse files
committed
TLS test fixes
1 parent 9e210f3 commit 5188919

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

redis_shard_test.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ func TestOptionsFromAddress(t *testing.T) {
116116
InitAddress: []string{"127.0.0.1:6379"},
117117
Dialer: net.Dialer{Timeout: 1 * time.Second},
118118
ConnWriteTimeout: 2 * time.Second,
119-
TLSConfig: &tls.Config{},
119+
TLSConfig: &tls.Config{
120+
MinVersion: tls.VersionTLS12,
121+
},
120122
},
121123
},
122124
{
@@ -165,7 +167,9 @@ func TestOptionsFromAddress(t *testing.T) {
165167
MasterSet: "mymaster",
166168
Username: "user",
167169
Password: "pass",
168-
TLSConfig: &tls.Config{},
170+
TLSConfig: &tls.Config{
171+
MinVersion: tls.VersionTLS12,
172+
},
169173
},
170174
},
171175
expectedIsSentinel: true,
@@ -177,7 +181,9 @@ func TestOptionsFromAddress(t *testing.T) {
177181
expectedError: nil,
178182
expectedOutput: rueidis.ClientOption{
179183
InitAddress: []string{"127.0.0.1:6379"},
180-
TLSConfig: &tls.Config{},
184+
TLSConfig: &tls.Config{
185+
MinVersion: tls.VersionTLS12,
186+
},
181187
},
182188
},
183189
{
@@ -186,13 +192,15 @@ func TestOptionsFromAddress(t *testing.T) {
186192
inputOptions: rueidis.ClientOption{
187193
TLSConfig: &tls.Config{
188194
InsecureSkipVerify: true,
195+
MinVersion: tls.VersionTLS12,
189196
},
190197
},
191198
expectedError: nil,
192199
expectedOutput: rueidis.ClientOption{
193200
InitAddress: []string{"127.0.0.1:6379"},
194201
TLSConfig: &tls.Config{
195202
InsecureSkipVerify: true,
203+
MinVersion: tls.VersionTLS12,
196204
},
197205
},
198206
},
@@ -221,6 +229,8 @@ func TestOptionsFromAddressUnix(t *testing.T) {
221229
require.NoError(t, err)
222230
require.Equal(t, opts.ClientOption.InitAddress, []string{"/tmp/redis.sock"})
223231
require.NotNil(t, opts.ClientOption.DialFn)
224-
_, err = opts.ClientOption.DialFn("", &net.Dialer{}, &tls.Config{})
232+
_, err = opts.ClientOption.DialFn("", &net.Dialer{}, &tls.Config{
233+
MinVersion: tls.VersionTLS12,
234+
})
225235
require.Error(t, err)
226236
}

0 commit comments

Comments
 (0)