Skip to content

Commit bb46a02

Browse files
committed
Update TestGetFile_checksumSkip to fix panic
Setting the file getter to nil causes a nil pointer panic. This updates things so that we remove the proxy getter and reset GetFileCalled so that we can test again whether or not it was called to attempt a re-download.
1 parent cde3ff4 commit bb46a02

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

get_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,15 @@ func TestGetFile_checksumSkip(t *testing.T) {
402402
t.Fatalf("bad: %s", v)
403403
}
404404

405-
// remove file getter as
406-
// client does the skip
407-
client.Getters["file"] = nil
405+
// remove proxy file getter and reset GetFileCalled so that we can re-test.
406+
getter.Proxy = nil
407+
getter.GetFileCalled = false
408408

409409
if err := client.Get(); err != nil {
410410
t.Fatalf("err: %s", err)
411411
}
412+
413+
if getter.GetFileCalled {
414+
t.Fatalf("get should not have been called")
415+
}
412416
}

0 commit comments

Comments
 (0)