Skip to content
This repository was 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 674c908

Browse files
BetaCat0lunny
authored andcommitted
make sure timeout in context timeout test (#1363)
1 parent 62d884e commit 674c908

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

engine_context_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ func TestPingContext(t *testing.T) {
2020
ctx, canceled := context.WithTimeout(context.Background(), time.Nanosecond)
2121
defer canceled()
2222

23+
time.Sleep(time.Nanosecond)
24+
2325
err := testEngine.(*Engine).PingContext(ctx)
2426
assert.Error(t, err)
2527
assert.Contains(t, err.Error(), "context deadline exceeded")

session_context_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ func TestQueryContext(t *testing.T) {
2626

2727
ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond)
2828
defer cancel()
29+
30+
time.Sleep(time.Nanosecond)
31+
2932
has, err := testEngine.Context(ctx).Exist(&ContextQueryStruct{Name: "1"})
3033
assert.Error(t, err)
3134
assert.Contains(t, err.Error(), "context deadline exceeded")

0 commit comments

Comments
 (0)