(t *testing.T)
| 388 | } |
| 389 | |
| 390 | func TestRWFileHandleWriteNoWrite(t *testing.T) { |
| 391 | r, vfs, fh := rwHandleCreateWriteOnly(t) |
| 392 | |
| 393 | // Close the file without writing to it |
| 394 | err := fh.Close() |
| 395 | if errors.Is(err, fs.ErrorCantUploadEmptyFiles) { |
| 396 | t.Logf("skipping test: %v", err) |
| 397 | return |
| 398 | } |
| 399 | assert.NoError(t, err) |
| 400 | |
| 401 | // Create a different file (not in the cache) |
| 402 | h, err := vfs.OpenFile("file2", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0777) |
| 403 | require.NoError(t, err) |
| 404 | |
| 405 | // Close it with Flush and Release |
| 406 | err = h.Flush() |
| 407 | assert.NoError(t, err) |
| 408 | err = h.Release() |
| 409 | assert.NoError(t, err) |
| 410 | |
| 411 | // check vfs |
| 412 | root, err := vfs.Root() |
| 413 | require.NoError(t, err) |
| 414 | checkListing(t, root, []string{"file1,0,false", "file2,0,false"}) |
| 415 | |
| 416 | // check the underlying r.Fremote but not the modtime |
| 417 | file1 := fstest.NewItem("file1", "", t1) |
| 418 | file2 := fstest.NewItem("file2", "", t1) |
| 419 | vfs.WaitForWriters(waitForWritersDelay) |
| 420 | fstest.CheckListingWithPrecision(t, r.Fremote, []fstest.Item{file1, file2}, []string{}, fs.ModTimeNotSupported) |
| 421 | } |
| 422 | |
| 423 | func TestRWFileHandleFlushWrite(t *testing.T) { |
| 424 | _, _, fh := rwHandleCreateWriteOnly(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…