Conversation
There was a problem hiding this comment.
Pull request overview
This pull request refactors test cases across the codebase to use test-managed contexts (t.Context(), b.Context(), or suite.T().Context()) instead of manually created contexts (context.Background() or context.TODO()). This enables proper test timeout and cancellation propagation through the testing framework.
Changes:
- Replace
context.Background()andcontext.TODO()witht.Context()in standalone test functions - Replace
context.Background()andcontext.TODO()withsuite.T().Context()in testify suite tests - Replace
context.Background()andcontext.TODO()withb.Context()in benchmark functions - Remove unused
contextpackage imports where no longer needed
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| worker/worker_test.go | Updated 17 test methods to use suite.T().Context() and 2 helper function calls to use t.Context() |
| worker/pipeline_test.go | Updated 3 usages to suite.T().Context() and removed unused context import |
| storage/vectors/database_test.go | Updated 3 test methods to use suite.T().Context() and removed unused context import |
| storage/data/no_database_test.go | Updated standalone test to use t.Context() and removed unused context import |
| storage/data/mongodb_test.go | Updated suite setup and benchmark to use suite.T().Context() and b.Context() respectively, removed unused context import |
| storage/data/database_test.go | Updated 10 test methods to use suite.T().Context() and 2 benchmark functions to use b.Context() |
| storage/cache/redis_test.go | Updated 5 test methods to use suite.T().Context() and 1 benchmark to use b.Context() |
| storage/cache/no_database_test.go | Updated standalone test to use t.Context() and removed unused context import |
| storage/cache/mongodb_test.go | Updated suite setup and benchmark to use suite.T().Context() and b.Context() respectively, removed unused context import |
| storage/cache/database_test.go | Updated 11 test methods to use suite.T().Context() and 3 benchmark functions to use b.Context() |
| storage/blob/s3_test.go | Updated test to use t.Context() and removed unused context import |
| storage/blob/gcs_test.go | Updated test to use t.Context() and removed unused context import |
| storage/blob/azure_test.go | Updated test to use t.Context() and removed unused context import |
| server/rest_test.go | Updated 19 test methods to use suite.T().Context() and removed unused context import |
| model/ctr/model_test.go | Updated 4 test functions to use t.Context() and removed unused context import |
| model/cf/model_test.go | Updated 2 test functions to use t.Context() and removed unused context import |
| master/tasks_test.go | Updated 11 test methods to use s.T().Context() and removed unused context import |
| master/rpc_test.go | Updated 5 test functions and helper calls to use t.Context() and removed unused context import |
| master/rest_test.go | Updated 19 test methods to use suite.T().Context() and removed unused context import |
| logics/recommend_test.go | Updated 15 test method calls to use suite.T().Context() and removed unused context import |
| logics/chat_test.go | Updated test to use t.Context() and removed unused context import |
| common/reranker/client_test.go | Updated test to use suite.T().Context() and removed unused context import |
| common/parallel/parallel_test.go | Updated 16 test functions to use t.Context() as base context for operations |
| common/mock/openai_test.go | Updated 3 test methods to use suite.T().Context() and removed unused context import |
| client/client_test.go | Updated 6 test methods to use suite.T().Context() and removed unused context import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1182 +/- ##
==========================================
+ Coverage 72.64% 72.66% +0.02%
==========================================
Files 87 87
Lines 16054 16054
==========================================
+ Hits 11662 11666 +4
+ Misses 3202 3198 -4
Partials 1190 1190 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.