@@ -303,21 +303,21 @@ func TestStorageCopyFromPath(t *testing.T) {
303
303
return
304
304
}
305
305
306
- matchFile := func (t * testing.T , storage * Storage , artifact sourcev1.Artifact , file * File , wantErr bool ) {
306
+ matchFile := func (t * testing.T , storage * Storage , artifact sourcev1.Artifact , file * File , expectMismatch bool ) {
307
307
c , err := os .ReadFile (storage .LocalPath (artifact ))
308
308
if err != nil {
309
309
t .Fatalf ("failed reading file: %v" , err )
310
310
}
311
- if (string (c ) != string (file .Content )) != wantErr {
312
- t .Errorf ("artifact content does not match, got: %q, want: %q" , string (c ), string (file .Content ))
311
+ if (string (c ) != string (file .Content )) != expectMismatch {
312
+ t .Errorf ("artifact content does not match and not expecting mismatch , got: %q, want: %q" , string (c ), string (file .Content ))
313
313
}
314
314
}
315
315
316
316
tests := []struct {
317
- name string
318
- file * File
319
- want * File
320
- wantErr bool
317
+ name string
318
+ file * File
319
+ want * File
320
+ expectMismatch bool
321
321
}{
322
322
{
323
323
name : "content match" ,
@@ -338,9 +338,9 @@ func TestStorageCopyFromPath(t *testing.T) {
338
338
},
339
339
want : & File {
340
340
Name : "manifest.yaml" ,
341
- Content : []byte (`bad contents` ),
341
+ Content : []byte (`mismatch contents` ),
342
342
},
343
- wantErr : true ,
343
+ expectMismatch : true ,
344
344
},
345
345
}
346
346
for _ , tt := range tests {
@@ -360,7 +360,7 @@ func TestStorageCopyFromPath(t *testing.T) {
360
360
if err := storage .CopyFromPath (& artifact , absPath ); err != nil {
361
361
t .Errorf ("CopyFromPath() error = %v" , err )
362
362
}
363
- matchFile (t , storage , artifact , tt .want , tt .wantErr )
363
+ matchFile (t , storage , artifact , tt .want , tt .expectMismatch )
364
364
})
365
365
}
366
366
}
0 commit comments