From fa23a9774a174cdd7012711f05918688f98ad7db Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 23 Sep 2018 13:22:18 +0800 Subject: [PATCH] PingContext test (#1103) --- context_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/context_test.go b/context_test.go index 29a6786b..17437af5 100644 --- a/context_test.go +++ b/context_test.go @@ -7,7 +7,9 @@ package xorm import ( + "context" "testing" + "time" "github.com/stretchr/testify/assert" ) @@ -15,10 +17,9 @@ import ( func TestPingContext(t *testing.T) { assert.NoError(t, prepareEngine()) - // TODO: Since EngineInterface should be compitable with old Go version, PingContext is not supported. - /* - ctx, _ := context.WithTimeout(context.Background(), 10*time.Second) - err := testEngine.PingContext(ctx) - assert.NoError(t, err) - */ + ctx, canceled := context.WithTimeout(context.Background(), 10*time.Second) + defer canceled() + + err := testEngine.(*Engine).PingContext(ctx) + assert.NoError(t, err) }