@@ -45,7 +45,10 @@ func TestStoreLoadCasPerm(t *testing.T) {
4545 for _ , tc := range tests {
4646 t .Run (tc .name , func (t * testing.T ) {
4747 root := t .TempDir ()
48- d := New (context .Background (), filepath .Join (root , "cache" ), 20 )
48+ d , err := New (context .Background (), filepath .Join (root , "cache" ), 20 )
49+ if err != nil {
50+ t .Errorf ("New: %v" , err )
51+ }
4952 defer d .Shutdown ()
5053 fname , _ := testutil .CreateFile (t , tc .executable , "12345" )
5154 srcInfo , err := os .Stat (fname )
@@ -83,7 +86,10 @@ func TestStoreLoadCasPerm(t *testing.T) {
8386
8487func TestLoadCasNotFound (t * testing.T ) {
8588 root := t .TempDir ()
86- d := New (context .Background (), filepath .Join (root , "cache" ), 20 )
89+ d , err := New (context .Background (), filepath .Join (root , "cache" ), 20 )
90+ if err != nil {
91+ t .Errorf ("New: %v" , err )
92+ }
8793 defer d .Shutdown ()
8894 newName := filepath .Join (root , "new" )
8995 dg := digest .NewFromBlob ([]byte ("bla" ))
@@ -94,7 +100,10 @@ func TestLoadCasNotFound(t *testing.T) {
94100
95101func TestStoreLoadActionCache (t * testing.T ) {
96102 root := t .TempDir ()
97- d := New (context .Background (), filepath .Join (root , "cache" ), 100 )
103+ d , err := New (context .Background (), filepath .Join (root , "cache" ), 100 )
104+ if err != nil {
105+ t .Errorf ("New: %v" , err )
106+ }
98107 defer d .Shutdown ()
99108 ar := & repb.ActionResult {
100109 OutputFiles : []* repb.OutputFile {
@@ -116,7 +125,10 @@ func TestStoreLoadActionCache(t *testing.T) {
116125
117126func TestGcOldestCas (t * testing.T ) {
118127 root := t .TempDir ()
119- d := New (context .Background (), filepath .Join (root , "cache" ), 20 )
128+ d , err := New (context .Background (), filepath .Join (root , "cache" ), 20 )
129+ if err != nil {
130+ t .Errorf ("New: %v" , err )
131+ }
120132 defer d .Shutdown ()
121133 d .testGcTicks = make (chan uint64 , 1 )
122134 for i := 0 ; i < 5 ; i ++ {
@@ -154,7 +166,10 @@ func TestGcOldestActionCache(t *testing.T) {
154166 }
155167 size := len (bytes )
156168 root := t .TempDir ()
157- d := New (context .Background (), filepath .Join (root , "cache" ), uint64 (size )* 4 )
169+ d , err := New (context .Background (), filepath .Join (root , "cache" ), uint64 (size )* 4 )
170+ if err != nil {
171+ t .Errorf ("New: %v" , err )
172+ }
158173 defer d .Shutdown ()
159174 d .testGcTicks = make (chan uint64 , 1 )
160175 for i := 0 ; i < 5 ; i ++ {
@@ -192,11 +207,11 @@ func TestGcOldestActionCache(t *testing.T) {
192207func isSystemLastAccessTimeAccurate (t * testing.T ) bool {
193208 t .Helper ()
194209 fname , _ := testutil .CreateFile (t , false , "foo" )
195- lat , _ := GetLastAccessTime (fname )
210+ lat , _ := getLastAccessTime (fname )
196211 if _ , err := os .ReadFile (fname ); err != nil {
197212 t .Fatalf ("%v" , err )
198213 }
199- newLat , _ := GetLastAccessTime (fname )
214+ newLat , _ := getLastAccessTime (fname )
200215 return lat .Before (newLat )
201216}
202217
@@ -209,7 +224,10 @@ func TestInitFromExistingCas(t *testing.T) {
209224 return
210225 }
211226 root := t .TempDir ()
212- d := New (context .Background (), filepath .Join (root , "cache" ), 20 )
227+ d , err := New (context .Background (), filepath .Join (root , "cache" ), 20 )
228+ if err != nil {
229+ t .Errorf ("New: %v" , err )
230+ }
213231 for i := 0 ; i < 4 ; i ++ {
214232 fname , _ := testutil .CreateFile (t , false , fmt .Sprintf ("aaa %d" , i ))
215233 dg , err := digest .NewFromFile (fname )
@@ -228,7 +246,10 @@ func TestInitFromExistingCas(t *testing.T) {
228246 d .Shutdown ()
229247
230248 // Re-initialize from existing files.
231- d = New (context .Background (), filepath .Join (root , "cache" ), 20 )
249+ d , err = New (context .Background (), filepath .Join (root , "cache" ), 20 )
250+ if err != nil {
251+ t .Errorf ("New: %v" , err )
252+ }
232253 defer d .Shutdown ()
233254 d .testGcTicks = make (chan uint64 , 1 )
234255
@@ -238,7 +259,7 @@ func TestInitFromExistingCas(t *testing.T) {
238259 t .Errorf ("expected %s to be cached" , dg )
239260 }
240261 fname , _ := testutil .CreateFile (t , false , "aaa 4" )
241- dg , err : = digest .NewFromFile (fname )
262+ dg , err = digest .NewFromFile (fname )
242263 if err != nil {
243264 t .Fatalf ("digest.NewFromFile failed: %v" , err )
244265 }
@@ -267,7 +288,10 @@ func TestThreadSafetyCas(t *testing.T) {
267288 nFiles := 10
268289 attempts := 5000
269290 // All blobs are size 5 exactly. We will have half the byte capacity we need.
270- d := New (context .Background (), filepath .Join (root , "cache" ), uint64 (nFiles * 5 )/ 2 )
291+ d , err := New (context .Background (), filepath .Join (root , "cache" ), uint64 (nFiles * 5 )/ 2 )
292+ if err != nil {
293+ t .Errorf ("New: %v" , err )
294+ }
271295 d .testGcTicks = make (chan uint64 , attempts )
272296 defer d .Shutdown ()
273297 var files []string
0 commit comments