MCPcopy
hub / github.com/rclone/rclone / TestInternalExpiredEntriesRemoved

Function TestInternalExpiredEntriesRemoved

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

Source from the content-addressed store, hash-verified

706}
707
708func TestInternalExpiredEntriesRemoved(t *testing.T) {
709 id := fmt.Sprintf("tieer%v", time.Now().Unix())
710 vfscommon.Opt.DirCacheTime = fs.Duration(time.Second * 4) // needs to be lower than the defined
711 rootFs, _ := runInstance.newCacheFs(t, remoteName, id, true, true, nil)
712 cfs, err := runInstance.getCacheFs(rootFs)
713 require.NoError(t, err)
714
715 // create some rand test data
716 runInstance.writeRemoteString(t, rootFs, "one", "one content")
717 runInstance.mkdir(t, rootFs, "test")
718 runInstance.writeRemoteString(t, rootFs, "test/second", "second content")
719
720 l, err := runInstance.list(t, rootFs, "test")
721 require.NoError(t, err)
722 require.Len(t, l, 1)
723
724 err = cfs.UnWrap().Mkdir(context.Background(), runInstance.encryptRemoteIfNeeded(t, "test/third"))
725 require.NoError(t, err)
726
727 l, err = runInstance.list(t, rootFs, "test")
728 require.NoError(t, err)
729 require.Len(t, l, 1)
730
731 err = runInstance.retryBlock(func() error {
732 l, err = runInstance.list(t, rootFs, "test")
733 if err != nil {
734 return err
735 }
736 if len(l) != 2 {
737 return errors.New("list is not 2")
738 }
739 return nil
740 }, 10, time.Second)
741 require.NoError(t, err)
742}
743
744func TestInternalBug2117(t *testing.T) {
745 vfscommon.Opt.DirCacheTime = fs.Duration(time.Second * 10)

Callers

nothing calls this directly

Calls 11

DurationTypeAlias · 0.92
newCacheFsMethod · 0.80
getCacheFsMethod · 0.80
writeRemoteStringMethod · 0.80
encryptRemoteIfNeededMethod · 0.80
retryBlockMethod · 0.80
MkdirMethod · 0.65
UnWrapMethod · 0.65
mkdirMethod · 0.45
listMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…