THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

make sure timeout in context timeout test (#1363)

tags/v0.7.5
BetaCat Lunny Xiao <xiaolunwen@gmail.com> 3 months ago
parent
commit
674c9089df
2 changed files with 5 additions and 0 deletions
  1. +2
    -0
      engine_context_test.go
  2. +3
    -0
      session_context_test.go

+ 2
- 0
engine_context_test.go View File

@@ -20,6 +20,8 @@ func TestPingContext(t *testing.T) {
ctx, canceled := context.WithTimeout(context.Background(), time.Nanosecond)
defer canceled()

time.Sleep(time.Nanosecond)

err := testEngine.(*Engine).PingContext(ctx)
assert.Error(t, err)
assert.Contains(t, err.Error(), "context deadline exceeded")


+ 3
- 0
session_context_test.go View File

@@ -26,6 +26,9 @@ func TestQueryContext(t *testing.T) {

ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond)
defer cancel()

time.Sleep(time.Nanosecond)

has, err := testEngine.Context(ctx).Exist(&ContextQueryStruct{Name: "1"})
assert.Error(t, err)
assert.Contains(t, err.Error(), "context deadline exceeded")


Loading…
Cancel
Save