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

chore(storage): fix Object Read not exist error #6648

Merged
merged 3 commits into from Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions storage/grpc_client.go
Expand Up @@ -893,6 +893,11 @@ func (c *grpcStorageClient) NewRangeReader(ctx context.Context, params *newRange
}

msg, err = stream.Recv()
// These types of errors show up on the Recv call, rather than the
// initialization of the stream via ReadObject above.
if s, ok := status.FromError(err); ok && s.Code() == codes.NotFound {
return ErrObjectNotExist
}

return err
}, s.retry, s.idempotent, setRetryHeaderGRPC(ctx))
Expand Down
10 changes: 10 additions & 0 deletions storage/integration_test.go
Expand Up @@ -2696,6 +2696,16 @@ func TestIntegration_Encryption(t *testing.T) {
}
}

func TestIntegration_NonexistentObjectRead(t *testing.T) {
t.Parallel()
multiTransportTest(context.Background(), t, func(t *testing.T, ctx context.Context, bucket, _ string, client *Client) {
_, err := client.Bucket(bucket).Object("object-does-not-exist").NewReader(ctx)
if !errors.Is(err, ErrObjectNotExist) {
t.Errorf("Objects: got %v, want ErrObjectNotExist", err)
}
})
}

func TestIntegration_NonexistentBucket(t *testing.T) {
t.Parallel()
ctx := context.Background()
Expand Down