fs/cache: add ClearConfig method to clear all remotes based on Config #4811
This commit is contained in:
parent
f4750928ee
commit
a10fbf16ea
2 changed files with 23 additions and 0 deletions
16
fs/cache/cache_test.go
vendored
16
fs/cache/cache_test.go
vendored
|
@ -166,6 +166,22 @@ func TestPin(t *testing.T) {
|
|||
Unpin(f2)
|
||||
}
|
||||
|
||||
func TestClearConfig(t *testing.T) {
|
||||
cleanup, create := mockNewFs(t)
|
||||
defer cleanup()
|
||||
|
||||
assert.Equal(t, 0, c.Entries())
|
||||
|
||||
_, err := GetFn(context.Background(), "mock:/file.txt", create)
|
||||
require.Equal(t, fs.ErrorIsFile, err)
|
||||
|
||||
assert.Equal(t, 2, Entries()) // file + parent
|
||||
|
||||
assert.Equal(t, 2, ClearConfig("mock"))
|
||||
|
||||
assert.Equal(t, 0, Entries())
|
||||
}
|
||||
|
||||
func TestClear(t *testing.T) {
|
||||
cleanup, create := mockNewFs(t)
|
||||
defer cleanup()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue