improve pingcontext tests

This commit is contained in:
Lunny Xiao 2019-01-17 15:44:02 +08:00
parent 3f7e4504d3
commit 1bedde5de1
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 3 additions and 2 deletions

View File

@ -17,9 +17,10 @@ import (
func TestPingContext(t *testing.T) {
assert.NoError(t, prepareEngine())
ctx, canceled := context.WithTimeout(context.Background(), 10*time.Second)
ctx, canceled := context.WithTimeout(context.Background(), time.Nanosecond)
defer canceled()
err := testEngine.(*Engine).PingContext(ctx)
assert.NoError(t, err)
assert.Error(t, err)
assert.Contains(t, err.Error(), "context deadline exceeded")
}