|
@@ -7,7 +7,9 @@
|
|
|
package xorm
|
|
package xorm
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "context"
|
|
|
"testing"
|
|
"testing"
|
|
|
|
|
+ "time"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/assert"
|
|
|
)
|
|
)
|
|
@@ -15,6 +17,12 @@ import (
|
|
|
func TestPingContext(t *testing.T) {
|
|
func TestPingContext(t *testing.T) {
|
|
|
assert.NoError(t, prepareEngine())
|
|
assert.NoError(t, prepareEngine())
|
|
|
|
|
|
|
|
|
|
+ ctx, canceled := context.WithTimeout(context.Background(), 10*time.Second)
|
|
|
|
|
+ defer canceled()
|
|
|
|
|
+
|
|
|
|
|
+ err := testEngine.(*Engine).PingContext(ctx)
|
|
|
|
|
+ assert.NoError(t, err)
|
|
|
|
|
+
|
|
|
// TODO: Since EngineInterface should be compitable with old Go version, PingContext is not supported.
|
|
// TODO: Since EngineInterface should be compitable with old Go version, PingContext is not supported.
|
|
|
/*
|
|
/*
|
|
|
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
|
|
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
|