@@ -3,7 +3,6 @@ package localfile
33import (
44 "archive/tar"
55 "bytes"
6- "context"
76 "errors"
87 "os"
98 "path/filepath"
@@ -85,7 +84,7 @@ func TestNew_NilConfig(t *testing.T) {
8584
8685func TestCreate (t * testing.T ) {
8786 lf := newTestLF (t )
88- ctx := context . Background ()
87+ ctx := t . Context ()
8988
9089 stream := makeTarGz (t , map [string ][]byte {
9190 "cow.raw" : []byte ("disk data" ),
@@ -120,7 +119,7 @@ func TestCreate(t *testing.T) {
120119
121120func TestCreate_NoName (t * testing.T ) {
122121 lf := newTestLF (t )
123- ctx := context . Background ()
122+ ctx := t . Context ()
124123
125124 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
126125 id , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t )}, stream )
@@ -134,7 +133,7 @@ func TestCreate_NoName(t *testing.T) {
134133
135134func TestCreate_DuplicateName (t * testing.T ) {
136135 lf := newTestLF (t )
137- ctx := context . Background ()
136+ ctx := t . Context ()
138137
139138 cfg := & types.SnapshotConfig {ID : testID (t ), Name : "dup" }
140139
@@ -156,7 +155,7 @@ func TestCreate_DuplicateName(t *testing.T) {
156155
157156func TestCreate_InvalidStream (t * testing.T ) {
158157 lf := newTestLF (t )
159- ctx := context . Background ()
158+ ctx := t . Context ()
160159
161160 _ , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t ), Name : "bad" }, strings .NewReader ("not gzip" ))
162161 if err == nil {
@@ -168,7 +167,7 @@ func TestCreate_InvalidStream(t *testing.T) {
168167
169168func TestList_Empty (t * testing.T ) {
170169 lf := newTestLF (t )
171- ctx := context . Background ()
170+ ctx := t . Context ()
172171
173172 result , err := lf .List (ctx )
174173 if err != nil {
@@ -181,7 +180,7 @@ func TestList_Empty(t *testing.T) {
181180
182181func TestList (t * testing.T ) {
183182 lf := newTestLF (t )
184- ctx := context . Background ()
183+ ctx := t . Context ()
185184
186185 for _ , name := range []string {"s1" , "s2" , "s3" } {
187186 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte (name )})
@@ -213,7 +212,7 @@ func TestList(t *testing.T) {
213212
214213func TestInspect_ByID (t * testing.T ) {
215214 lf := newTestLF (t )
216- ctx := context . Background ()
215+ ctx := t . Context ()
217216
218217 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
219218 id , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t ), Name : "byid" , Description : "desc" }, stream )
@@ -238,7 +237,7 @@ func TestInspect_ByID(t *testing.T) {
238237
239238func TestInspect_ByName (t * testing.T ) {
240239 lf := newTestLF (t )
241- ctx := context . Background ()
240+ ctx := t . Context ()
242241
243242 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
244243 id , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t ), Name : "byname" }, stream )
@@ -257,7 +256,7 @@ func TestInspect_ByName(t *testing.T) {
257256
258257func TestInspect_ByPrefix (t * testing.T ) {
259258 lf := newTestLF (t )
260- ctx := context . Background ()
259+ ctx := t . Context ()
261260
262261 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
263262 id , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t ), Name : "pfx" }, stream )
@@ -278,7 +277,7 @@ func TestInspect_ByPrefix(t *testing.T) {
278277
279278func TestInspect_NotFound (t * testing.T ) {
280279 lf := newTestLF (t )
281- ctx := context . Background ()
280+ ctx := t . Context ()
282281
283282 _ , err := lf .Inspect (ctx , "nonexistent" )
284283 if err == nil {
@@ -293,7 +292,7 @@ func TestInspect_NotFound(t *testing.T) {
293292
294293func TestDelete (t * testing.T ) {
295294 lf := newTestLF (t )
296- ctx := context . Background ()
295+ ctx := t . Context ()
297296
298297 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
299298 id , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t ), Name : "del" }, stream )
@@ -328,7 +327,7 @@ func TestDelete(t *testing.T) {
328327
329328func TestDelete_ByID (t * testing.T ) {
330329 lf := newTestLF (t )
331- ctx := context . Background ()
330+ ctx := t . Context ()
332331
333332 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
334333 id , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t ), Name : "delid" }, stream )
@@ -347,7 +346,7 @@ func TestDelete_ByID(t *testing.T) {
347346
348347func TestDelete_Multiple (t * testing.T ) {
349348 lf := newTestLF (t )
350- ctx := context . Background ()
349+ ctx := t . Context ()
351350
352351 var ids []string
353352 for _ , name := range []string {"m1" , "m2" , "m3" } {
@@ -376,7 +375,7 @@ func TestDelete_Multiple(t *testing.T) {
376375
377376func TestDelete_DuplicateRefs (t * testing.T ) {
378377 lf := newTestLF (t )
379- ctx := context . Background ()
378+ ctx := t . Context ()
380379
381380 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
382381 id , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t ), Name : "dedup" }, stream )
@@ -396,7 +395,7 @@ func TestDelete_DuplicateRefs(t *testing.T) {
396395
397396func TestDelete_NotFound (t * testing.T ) {
398397 lf := newTestLF (t )
399- ctx := context . Background ()
398+ ctx := t . Context ()
400399
401400 _ , err := lf .Delete (ctx , []string {"nonexistent" })
402401 if err == nil {
@@ -408,7 +407,7 @@ func TestDelete_NotFound(t *testing.T) {
408407
409408func TestCreate_Inspect_Fields (t * testing.T ) {
410409 lf := newTestLF (t )
411- ctx := context . Background ()
410+ ctx := t . Context ()
412411
413412 stream := makeTarGz (t , map [string ][]byte {"cow.raw" : []byte ("data" )})
414413 cfg := & types.SnapshotConfig {
@@ -445,7 +444,7 @@ func TestCreate_Inspect_Fields(t *testing.T) {
445444
446445func TestDelete_RecreateName (t * testing.T ) {
447446 lf := newTestLF (t )
448- ctx := context . Background ()
447+ ctx := t . Context ()
449448
450449 stream1 := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("v1" )})
451450 _ , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t ), Name : "reuse" }, stream1 )
@@ -476,7 +475,7 @@ func TestDelete_RecreateName(t *testing.T) {
476475
477476func TestDataDir (t * testing.T ) {
478477 lf := newTestLF (t )
479- ctx := context . Background ()
478+ ctx := t . Context ()
480479
481480 stream := makeTarGz (t , map [string ][]byte {"cow.raw" : []byte ("disk" )})
482481 cfg := & types.SnapshotConfig {
@@ -513,7 +512,7 @@ func TestDataDir(t *testing.T) {
513512
514513func TestDataDir_NotFound (t * testing.T ) {
515514 lf := newTestLF (t )
516- ctx := context . Background ()
515+ ctx := t . Context ()
517516
518517 _ , _ , err := lf .DataDir (ctx , "nonexistent" )
519518 if err == nil {
@@ -526,7 +525,7 @@ func TestDataDir_NotFound(t *testing.T) {
526525
527526func TestDataDir_ImageBlobIDsIsolation (t * testing.T ) {
528527 lf := newTestLF (t )
529- ctx := context . Background ()
528+ ctx := t . Context ()
530529
531530 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
532531 cfg := & types.SnapshotConfig {
@@ -563,7 +562,7 @@ func TestDataDir_ImageBlobIDsIsolation(t *testing.T) {
563562
564563func TestRestore_ConfigRoundtrip (t * testing.T ) {
565564 lf := newTestLF (t )
566- ctx := context . Background ()
565+ ctx := t . Context ()
567566
568567 stream := makeTarGz (t , map [string ][]byte {"cow.raw" : []byte ("disk" )})
569568 cfg := & types.SnapshotConfig {
@@ -617,7 +616,7 @@ func TestRestore_ConfigRoundtrip(t *testing.T) {
617616
618617func TestRestore_DataStream (t * testing.T ) {
619618 lf := newTestLF (t )
620- ctx := context . Background ()
619+ ctx := t . Context ()
621620
622621 wantContent := []byte ("hello snapshot data" )
623622 stream := makeTarGz (t , map [string ][]byte {"state.json" : wantContent })
@@ -660,7 +659,7 @@ func TestRestore_DataStream(t *testing.T) {
660659
661660func TestRestore_CloseWaitsForGoroutine (t * testing.T ) {
662661 lf := newTestLF (t )
663- ctx := context . Background ()
662+ ctx := t . Context ()
664663
665664 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
666665 id , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t ), Name : "cw" }, stream )
@@ -684,7 +683,7 @@ func TestRestore_CloseWaitsForGoroutine(t *testing.T) {
684683
685684func TestRestore_DoubleCloseNoPanic (t * testing.T ) {
686685 lf := newTestLF (t )
687- ctx := context . Background ()
686+ ctx := t . Context ()
688687
689688 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
690689 id , err := lf .Create (ctx , & types.SnapshotConfig {ID : testID (t ), Name : "dc" }, stream )
@@ -705,7 +704,7 @@ func TestRestore_DoubleCloseNoPanic(t *testing.T) {
705704
706705func TestRestore_ImageBlobIDsIsolation (t * testing.T ) {
707706 lf := newTestLF (t )
708- ctx := context . Background ()
707+ ctx := t . Context ()
709708
710709 stream := makeTarGz (t , map [string ][]byte {"f.txt" : []byte ("x" )})
711710 cfg := & types.SnapshotConfig {
0 commit comments