Skip to content

Commit

Permalink
Actually try writing to gcs to get error on IfNotExists in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajroetker committed Nov 1, 2019
1 parent 8e0c0c0 commit 36a891b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion testutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,14 @@ func TestReadWriteCloser(t TestingT, store cloudstorage.Store) {
assert.Equalf(t, nil, err, "at loop-cnt:%v", i)
time.Sleep(time.Millisecond * 100)

_, err = store.NewWriterWithContext(context.Background(), fileName, nil, cloudstorage.Opts{IfNotExists: true})
wc, err = store.NewWriterWithContext(context.Background(), fileName, nil, cloudstorage.Opts{IfNotExists: true})
if err == nil {
// If err == nil then we're gcs so try writing
_, err = bytes.NewBufferString(data).WriteTo(wc)
assert.NoErrorf(t, err, "at loop-cnt:%v", i)
err = wc.Close()
time.Sleep(time.Millisecond * 100)
}
assert.Error(t, err)

// Read the object from store, delete if it exists
Expand Down

0 comments on commit 36a891b

Please sign in to comment.