-
Notifications
You must be signed in to change notification settings - Fork 883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GODRIVER-1806 Fix and test DownloadStream.Skip() #557
Conversation
kevinAlbs
commented
Jan 5, 2021
- Fix bug when skip lands on chunk boundary
- Fix bug when skip lands on chunk boundary
e8163d5
to
4787346
Compare
I believe the test failures of |
@@ -193,29 +193,26 @@ func (ds *DownloadStream) Skip(skip int64) (int64, error) { | |||
var err error | |||
|
|||
for skipped < skip { | |||
if ds.bufferStart == 0 { | |||
if ds.bufferStart >= ds.bufferEnd { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now more closely follows the logic of Read
.
mongo/integration/gridfs_test.go
Outdated
"read 0, skip 0", 0, 0, 0, nil, "abc.def.ghi", | ||
}, | ||
{ | ||
"read 0, skip to end of chunk", 0, 4, 4, nil, "def.ghi", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tests problem 2 described in the ticket.
mongo/integration/gridfs_test.go
Outdated
"read 0, skip 1", 0, 1, 1, nil, "bc.def.ghi", | ||
}, | ||
{ | ||
"read 1, skip to end of chunk", 1, 3, 3, nil, "def.ghi", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tests problem 1 described in the ticket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just a few small comments on tests.