context_test.go 760 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2017 The Xorm Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build go1.8
  5. package xorm
  6. import (
  7. "context"
  8. "testing"
  9. "time"
  10. "github.com/stretchr/testify/assert"
  11. )
  12. func TestPingContext(t *testing.T) {
  13. assert.NoError(t, prepareEngine())
  14. ctx, canceled := context.WithTimeout(context.Background(), 10*time.Second)
  15. defer canceled()
  16. err := testEngine.(*Engine).PingContext(ctx)
  17. assert.NoError(t, err)
  18. // TODO: Since EngineInterface should be compitable with old Go version, PingContext is not supported.
  19. /*
  20. ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
  21. err := testEngine.PingContext(ctx)
  22. assert.NoError(t, err)
  23. */
  24. }