MCPcopy
hub / github.com/rclone/rclone / TestCacheTotaInUse

Function TestCacheTotaInUse

vfs/vfscache/cache_test.go:676–701  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

674}
675
676func TestCacheTotaInUse(t *testing.T) {
677 _, c := newTestCache(t)
678
679 assert.Equal(t, int(0), c.TotalInUse())
680
681 potato := c.Item("potato")
682 assert.Equal(t, int(0), c.TotalInUse())
683
684 require.NoError(t, potato.Open(nil))
685 assert.Equal(t, int(1), c.TotalInUse())
686
687 require.NoError(t, potato.Truncate(5))
688 assert.Equal(t, int(1), c.TotalInUse())
689
690 potato2 := c.Item("potato2")
691 assert.Equal(t, int(1), c.TotalInUse())
692
693 require.NoError(t, potato2.Open(nil))
694 assert.Equal(t, int(2), c.TotalInUse())
695
696 require.NoError(t, potato2.Close(nil))
697 assert.Equal(t, int(1), c.TotalInUse())
698
699 require.NoError(t, potato.Close(nil))
700 assert.Equal(t, int(0), c.TotalInUse())
701}
702
703func TestCacheDump(t *testing.T) {
704 _, c := newTestCache(t)

Callers

nothing calls this directly

Calls 7

newTestCacheFunction · 0.85
TotalInUseMethod · 0.80
ItemMethod · 0.80
OpenMethod · 0.65
TruncateMethod · 0.65
CloseMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…