PingContext test (#1103)

This commit is contained in:
Lunny Xiao 2018-09-23 13:22:18 +08:00 committed by GitHub
parent 1261905a94
commit fa23a9774a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -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)
}