ソースを参照

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)