Skip to content

Commit 7402744

Browse files
authored
test(storage): fix append edge case test (googleapis#12947)
The expected behavior for overwriting an appendable object has changed on the server side, which caused the test to start failing. Update the test to fix this. Fixes googleapis#12850
1 parent 7b23654 commit 7402744

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

storage/integration_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3624,21 +3624,20 @@ func TestIntegration_WriterAppendEdgeCases(t *testing.T) {
36243624
t.Fatalf("w.Write: got error %v, want FailedPrecondition or Aborted", err)
36253625
}
36263626

3627-
// Another NewWriter to the unfinalized object should also return an
3628-
// error when data is flushed.
3627+
// Another NewWriter to the unfinalized object should be able to
3628+
// overwrite the existing object.
36293629
w2 := obj.NewWriter(ctx)
36303630
w2.Append = true
36313631
if _, err := w2.Write([]byte("hello world")); err != nil {
36323632
t.Fatalf("w2.Write: %v", err)
36333633
}
3634-
_, err = w2.Flush()
3635-
if code := status.Code(err); !(code == codes.FailedPrecondition || code == codes.Aborted) {
3636-
t.Fatalf("w2.Flush: got error %v, want FailedPrecondition or Aborted", err)
3634+
if err := w2.Close(); err != nil {
3635+
t.Fatalf("w2.Close: %v", err)
36373636
}
36383637

36393638
// If we add yet another takeover writer to finalize and delete the object,
3640-
// tw should also return an error on flush.
3641-
tw2, _, err := obj.Generation(w.Attrs().Generation).NewWriterFromAppendableObject(ctx, &AppendableWriterOpts{
3639+
// tw should return an error on flush.
3640+
tw2, _, err := obj.Generation(w2.Attrs().Generation).NewWriterFromAppendableObject(ctx, &AppendableWriterOpts{
36423641
FinalizeOnClose: true,
36433642
})
36443643
if err != nil {

0 commit comments

Comments
 (0)