fs/cache: add ClearConfig method to clear all remotes based on Config #4811

This commit is contained in:
Nick Craig-Wood 2020-11-30 11:52:25 +00:00
parent f4750928ee
commit a10fbf16ea
2 changed files with 23 additions and 0 deletions

View file

@ -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()