@@ -22,7 +22,7 @@ import (
2222)
2323
2424func TestBulkCreate (t * testing.T ) {
25- ctx , cn := context .WithCancel (context . Background ())
25+ ctx , cn := context .WithCancel (t . Context ())
2626 defer cn ()
2727
2828 index , bulker := SetupIndexWithBulk (ctx , t , testPolicy , WithFlushThresholdCount (1 ))
@@ -124,7 +124,7 @@ func TestBulkCreate(t *testing.T) {
124124}
125125
126126func TestBulkCreateBody (t * testing.T ) {
127- ctx , cn := context .WithCancel (context . Background ())
127+ ctx , cn := context .WithCancel (t . Context ())
128128 defer cn ()
129129
130130 index , bulker := SetupIndexWithBulk (ctx , t , testPolicy , WithFlushThresholdCount (1 ))
@@ -177,7 +177,7 @@ func TestBulkCreateBody(t *testing.T) {
177177}
178178
179179func TestBulkIndex (t * testing.T ) {
180- ctx , cn := context .WithCancel (context . Background ())
180+ ctx , cn := context .WithCancel (t . Context ())
181181 defer cn ()
182182 ctx = testlog .SetLogger (t ).WithContext (ctx )
183183
@@ -201,7 +201,7 @@ func TestBulkIndex(t *testing.T) {
201201}
202202
203203func TestBulkUpdate (t * testing.T ) {
204- ctx , cn := context .WithCancel (context . Background ())
204+ ctx , cn := context .WithCancel (t . Context ())
205205 defer cn ()
206206 ctx = testlog .SetLogger (t ).WithContext (ctx )
207207
@@ -240,7 +240,7 @@ func TestBulkUpdate(t *testing.T) {
240240}
241241
242242func TestBulkSearch (t * testing.T ) {
243- ctx , cn := context .WithCancel (context . Background ())
243+ ctx , cn := context .WithCancel (t . Context ())
244244 defer cn ()
245245 ctx = testlog .SetLogger (t ).WithContext (ctx )
246246
@@ -283,7 +283,7 @@ func TestBulkSearch(t *testing.T) {
283283}
284284
285285func TestBulkSearchWithIgnoreUnavailable (t * testing.T ) {
286- ctx , cn := context .WithCancel (context . Background ())
286+ ctx , cn := context .WithCancel (t . Context ())
287287 defer cn ()
288288 ctx = testlog .SetLogger (t ).WithContext (ctx )
289289
@@ -306,7 +306,7 @@ func TestBulkSearchWithIgnoreUnavailable(t *testing.T) {
306306}
307307
308308func TestBulkDelete (t * testing.T ) {
309- ctx , cn := context .WithCancel (context . Background ())
309+ ctx , cn := context .WithCancel (t . Context ())
310310 defer cn ()
311311 ctx = testlog .SetLogger (t ).WithContext (ctx )
312312
@@ -344,7 +344,7 @@ func TestBulkDelete(t *testing.T) {
344344func benchmarkCreate (n int , b * testing.B ) {
345345 b .ReportAllocs ()
346346
347- ctx , cn := context .WithCancel (context . Background ())
347+ ctx , cn := context .WithCancel (b . Context ())
348348 defer cn ()
349349 ctx = testlog .SetLogger (b ).WithContext (ctx )
350350
@@ -396,7 +396,7 @@ func BenchmarkCreate(b *testing.B) {
396396// Not a particularly useful benchmark, but gives some idea of memory overhead.
397397
398398func benchmarkCRUD (n int , b * testing.B ) {
399- ctx , cn := context .WithCancel (context . Background ())
399+ ctx , cn := context .WithCancel (b . Context ())
400400 defer cn ()
401401 ctx = testlog .SetLogger (b ).WithContext (ctx )
402402
0 commit comments