-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
test(storage): add WriteTo integration test cases #9681
test(storage): add WriteTo integration test cases #9681
Conversation
Update the most important integration tests for Reader to cover both Read and WriteTo. Also remove refs to deprecated ioutil.
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.
A couple suggestions but otherwise LGTM
// Check early close. | ||
buf := make([]byte, 1) | ||
rc, err = b.Object(obj).NewReader(ctx) | ||
if err != nil { | ||
t.Fatalf("%v: %v", obj, err) | ||
} | ||
_, err = rc.Read(buf) | ||
if err != nil { | ||
t.Fatalf("%v: %v", obj, err) | ||
} | ||
if got, want := buf, contents[obj][:1]; !bytes.Equal(got, want) { | ||
t.Errorf("Contents[0] (%q) = %q; want %q", obj, got, want) | ||
} | ||
if err := rc.Close(); err != nil { | ||
t.Errorf("%v Close: %v", obj, err) | ||
} |
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.
Suggestion: Can this be moved out one level? I don't think we need to test this for both read funcs.
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.
I think it's fine to leave it as is; it doesn't shrink the test matrix at all to make this change.
Update the most important integration tests for Reader to cover both Read and WriteTo.
Also remove refs to deprecated ioutil.