forked from TrueCloudLab/restic
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:
parent
57d8eedb88
commit
40ac678252
24 changed files with 47 additions and 230 deletions
|
@ -66,12 +66,12 @@ func newSwiftTestSuite(t testing.TB) *test.Suite {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
exists, err := be.Test(context.TODO(), restic.Handle{Type: restic.ConfigFile})
|
||||
if err != nil {
|
||||
_, err = be.Stat(context.TODO(), restic.Handle{Type: restic.ConfigFile})
|
||||
if err != nil && !be.IsNotExist(err) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if exists {
|
||||
if err == nil {
|
||||
return nil, errors.New("config already exists")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue