mirror of
https://github.com/restic/restic.git
synced 2025-08-23 05:37:25 +00:00
backend: remove Test method
The Test method was only used in exactly one place, namely when trying to create a new repository it was used to check whether a config file already exists. Use a combination of Stat() and IsNotExist() instead.
This commit is contained in:
@@ -41,12 +41,9 @@ func TestDry(t *testing.T) {
|
||||
{d, "stat", "a", "", "not found"},
|
||||
{d, "list", "", "", ""},
|
||||
{d, "save", "", "", "invalid"},
|
||||
{d, "test", "a", "", ""},
|
||||
{m, "save", "a", "baz", ""}, // save a directly to the mem backend
|
||||
{d, "save", "b", "foob", ""}, // b is not saved
|
||||
{d, "save", "b", "xxx", ""}, // no error as b is not saved
|
||||
{d, "test", "a", "1", ""},
|
||||
{d, "test", "b", "", ""},
|
||||
{d, "stat", "", "", "invalid"},
|
||||
{d, "stat", "a", "a 3", ""},
|
||||
{d, "load", "a", "baz", ""},
|
||||
@@ -65,17 +62,11 @@ func TestDry(t *testing.T) {
|
||||
|
||||
for i, step := range steps {
|
||||
var err error
|
||||
var boolRes bool
|
||||
|
||||
handle := restic.Handle{Type: restic.PackFile, Name: step.fname}
|
||||
switch step.op {
|
||||
case "save":
|
||||
err = step.be.Save(ctx, handle, restic.NewByteReader([]byte(step.content), step.be.Hasher()))
|
||||
case "test":
|
||||
boolRes, err = step.be.Test(ctx, handle)
|
||||
if boolRes != (step.content != "") {
|
||||
t.Errorf("%d. Test(%q) = %v, want %v", i, step.fname, boolRes, step.content != "")
|
||||
}
|
||||
case "list":
|
||||
fileList := []string{}
|
||||
err = step.be.List(ctx, restic.PackFile, func(fi restic.FileInfo) error {
|
||||
|
Reference in New Issue
Block a user