Skip to content

Commit 562f06d

Browse files
committed
Merge pull request getlantern#2789 from getlantern/issue-2703
Fix for 2703
2 parents ce0727e + 2748804 commit 562f06d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/github.com/getlantern/tlsdialer/tlsdialer_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,15 @@ func doTestTimeout(t *testing.T, timeout time.Duration) {
214214
_, err := DialWithDialer(&net.Dialer{
215215
Timeout: timeout,
216216
}, "tcp", ADDR, false, nil)
217+
217218
assert.Error(t, err, "There should have been a problem dialing", timeout)
219+
218220
if err != nil {
219-
assert.True(t, err.(net.Error).Timeout(), "Dial error should be timeout", timeout)
221+
if neterr, isNetError := err.(net.Error); isNetError {
222+
assert.True(t, neterr.Timeout(), "Dial error should be timeout", timeout)
223+
} else {
224+
t.Fatal(err)
225+
}
220226
}
221227
}
222228

@@ -230,9 +236,15 @@ func TestDeadlineBeforeTimeout(t *testing.T) {
230236
Timeout: 500 * time.Second,
231237
Deadline: time.Now().Add(5 * time.Microsecond),
232238
}, "tcp", ADDR, false, nil)
239+
233240
assert.Error(t, err, "There should have been a problem dialing")
241+
234242
if err != nil {
235-
assert.True(t, err.(net.Error).Timeout(), "Dial error should be timeout")
243+
if neterr, isNetError := err.(net.Error); isNetError {
244+
assert.True(t, neterr.Timeout(), "Dial error should be timeout")
245+
} else {
246+
t.Fatal(err)
247+
}
236248
}
237249

238250
closeAndCountFDs(t, conn, err, fdc)

0 commit comments

Comments
 (0)