MCPcopy Index your code
hub / github.com/rclone/rclone / TestWriteBackAddUpdateNotModified

Function TestWriteBackAddUpdateNotModified

vfs/vfscache/writeback/writeback_test.go:393–428  ·  view source on GitHub ↗

Now test the upload being not cancelled by another upload being added

(t *testing.T)

Source from the content-addressed store, hash-verified

391
392// Now test the upload being not cancelled by another upload being added
393func TestWriteBackAddUpdateNotModified(t *testing.T) {
394 wb, cancel := newTestWriteBack(t)
395 defer cancel()
396
397 pi := newPutItem(t)
398
399 id := wb.Add(0, "one", 10, false, pi.put)
400 wbItem := wb.lookup[id]
401 checkOnHeap(t, wb, wbItem)
402 checkInLookup(t, wb, wbItem)
403 assert.Equal(t, "one", wb.string(t))
404
405 <-pi.started
406 checkNotOnHeap(t, wb, wbItem)
407 checkInLookup(t, wb, wbItem)
408
409 // Now the upload has started add another one
410
411 pi2 := newPutItem(t)
412 id2 := wb.Add(id, "one", 10, false, pi2.put)
413 assert.Equal(t, id, id2)
414 checkNotOnHeap(t, wb, wbItem) // object still being transferred
415 checkInLookup(t, wb, wbItem)
416
417 // Because modified was false above this should not cancel the
418 // transfer
419 assert.False(t, pi.cancelled)
420
421 // wait for original transfer to finish
422 pi.finish(nil)
423 waitUntilNoTransfers(t, wb)
424 checkNotOnHeap(t, wb, wbItem)
425 checkNotInLookup(t, wb, wbItem)
426
427 assert.False(t, pi2.called)
428}
429
430// Now test the upload being not cancelled by another upload being
431// added because the upload hasn't started yet

Callers

nothing calls this directly

Calls 11

newTestWriteBackFunction · 0.85
newPutItemFunction · 0.85
checkOnHeapFunction · 0.85
checkInLookupFunction · 0.85
checkNotOnHeapFunction · 0.85
waitUntilNoTransfersFunction · 0.85
checkNotInLookupFunction · 0.85
AddMethod · 0.65
EqualMethod · 0.45
stringMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…