Skip to content
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

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

tritone
Copy link
Contributor

@tritone tritone commented Apr 1, 2024

Update the most important integration tests for Reader to cover both Read and WriteTo.

Also remove refs to deprecated ioutil.

Update the most important integration tests for Reader to cover both
Read and WriteTo.

Also remove refs to deprecated ioutil.
@tritone tritone requested review from a team as code owners April 1, 2024 21:13
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Apr 1, 2024
Copy link
Contributor

@BrennaEpp BrennaEpp left a 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

storage/integration_test.go Outdated Show resolved Hide resolved
storage/integration_test.go Outdated Show resolved Hide resolved
storage/integration_test.go Outdated Show resolved Hide resolved
Comment on lines +4556 to +4571
// 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)
}
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@tritone tritone added the automerge Merge the pull request once unit tests and other checks pass. label Apr 3, 2024
@gcf-merge-on-green gcf-merge-on-green bot merged commit ea0795d into googleapis:main Apr 3, 2024
8 checks passed
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants