Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
make sure timeout in context timeout test (#1363)
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaCat0 authored and lunny committed Jul 23, 2019
1 parent 62d884e commit 674c908
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions engine_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions session_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 674c908

Please sign in to comment.