MCPcopy
hub / github.com/rclone/rclone / TestWriteBackAddOK

Function TestWriteBackAddOK

vfs/vfscache/writeback/writeback_test.go:291–316  ·  view source on GitHub ↗

This is the happy path with everything working

(t *testing.T)

Source from the content-addressed store, hash-verified

289
290// This is the happy path with everything working
291func TestWriteBackAddOK(t *testing.T) {
292 wb, cancel := newTestWriteBack(t)
293 defer cancel()
294
295 pi := newPutItem(t)
296
297 var inID Handle
298 wb.SetID(&inID)
299 assert.Equal(t, Handle(1), inID)
300
301 id := wb.Add(inID, "one", 10, true, pi.put)
302 assert.Equal(t, inID, id)
303 wbItem := wb.lookup[id]
304 checkOnHeap(t, wb, wbItem)
305 checkInLookup(t, wb, wbItem)
306 assert.Equal(t, "one", wb.string(t))
307
308 <-pi.started
309 checkNotOnHeap(t, wb, wbItem)
310 checkInLookup(t, wb, wbItem)
311
312 pi.finish(nil) // transfer successful
313 waitUntilNoTransfers(t, wb)
314 checkNotOnHeap(t, wb, wbItem)
315 checkNotInLookup(t, wb, wbItem)
316}
317
318// Now test the upload failing and being retried
319func TestWriteBackAddFailRetry(t *testing.T) {

Callers

nothing calls this directly

Calls 13

newTestWriteBackFunction · 0.85
newPutItemFunction · 0.85
checkOnHeapFunction · 0.85
checkInLookupFunction · 0.85
checkNotOnHeapFunction · 0.85
waitUntilNoTransfersFunction · 0.85
checkNotInLookupFunction · 0.85
HandleTypeAlias · 0.70
AddMethod · 0.65
SetIDMethod · 0.45
EqualMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…