Skip to content

Commit

Permalink
Added test for deadline handling
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Oct 30, 2014
1 parent b23b516 commit 7df6819
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tlsdialer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,14 @@ func doTestTimeout(t *testing.T, timeout time.Duration) {
assert.True(t, err.(net.Error).Timeout(), "Dial error should be timeout", timeout)
}
}

func TestDeadlineBeforeTimeout(t *testing.T) {
_, err := DialWithDialer(&net.Dialer{
Timeout: 500 * time.Second,
Deadline: time.Now().Add(5 * time.Microsecond),
}, "tcp", ADDR, false, nil)
assert.Error(t, err, "There should have been a problem dialing")
if err != nil {
assert.True(t, err.(net.Error).Timeout(), "Dial error should be timeout")
}
}

0 comments on commit 7df6819

Please sign in to comment.