diff --git a/engine_context_test.go b/engine_context_test.go index cc564694..1a3276ce 100644 --- a/engine_context_test.go +++ b/engine_context_test.go @@ -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") diff --git a/session_context_test.go b/session_context_test.go index b6fd1f6e..2784468d 100644 --- a/session_context_test.go +++ b/session_context_test.go @@ -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")