MCPcopy
hub / github.com/rclone/rclone / TestInternalCacheWrites

Function TestInternalCacheWrites

backend/cache/cache_internal_test.go:653–669  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

651}
652
653func TestInternalCacheWrites(t *testing.T) {
654 id := "ticw"
655 rootFs, boltDb := runInstance.newCacheFs(t, remoteName, id, false, true, map[string]string{"writes": "true"})
656
657 cfs, err := runInstance.getCacheFs(rootFs)
658 require.NoError(t, err)
659 chunkSize := cfs.ChunkSize()
660
661 // create some rand test data
662 earliestTime := time.Now()
663 testData := randStringBytes(int(chunkSize*4 + chunkSize/2))
664 runInstance.writeRemoteBytes(t, rootFs, "data.bin", testData)
665 expectedTs := time.Now()
666 ts, err := boltDb.GetChunkTs(runInstance.encryptRemoteIfNeeded(t, path.Join(rootFs.Root(), "data.bin")), 0)
667 require.NoError(t, err)
668 require.WithinDuration(t, expectedTs, ts, expectedTs.Sub(earliestTime))
669}
670
671func TestInternalMaxChunkSizeRespected(t *testing.T) {
672 if runtime.GOOS == "windows" && runtime.GOARCH == "386" {

Callers

nothing calls this directly

Calls 9

randStringBytesFunction · 0.85
newCacheFsMethod · 0.80
getCacheFsMethod · 0.80
ChunkSizeMethod · 0.80
writeRemoteBytesMethod · 0.80
GetChunkTsMethod · 0.80
encryptRemoteIfNeededMethod · 0.80
JoinMethod · 0.80
RootMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…