From 1bedde5de173693a27878cb8e51d70dc6aca3f9e Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 17 Jan 2019 15:44:02 +0800 Subject: [PATCH] improve pingcontext tests --- engine_context_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine_context_test.go b/engine_context_test.go index 17437af5..cc564694 100644 --- a/engine_context_test.go +++ b/engine_context_test.go @@ -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") }