瀏覽代碼

PingContext test

xormplus 7 年之前
父節點
當前提交
95c6519a6c
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      context_test.go

+ 8 - 0
context_test.go

@@ -7,7 +7,9 @@
 package xorm
 
 import (
+	"context"
 	"testing"
+	"time"
 
 	"github.com/stretchr/testify/assert"
 )
@@ -15,6 +17,12 @@ import (
 func TestPingContext(t *testing.T) {
 	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.
 	/*
 		ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)