forked from TrueCloudLab/restic
restic: remove backend usage from lock test
This commit is contained in:
parent
67e2ba0d40
commit
e40943a75d
1 changed files with 10 additions and 7 deletions
|
@ -190,13 +190,16 @@ func TestLockStale(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func lockExists(repo restic.Repository, t testing.TB, id restic.ID) bool {
|
func lockExists(repo restic.Repository, t testing.TB, lockID restic.ID) bool {
|
||||||
h := backend.Handle{Type: restic.LockFile, Name: id.String()}
|
var exists bool
|
||||||
_, err := repo.Backend().Stat(context.TODO(), h)
|
rtest.OK(t, repo.List(context.TODO(), restic.LockFile, func(id restic.ID, size int64) error {
|
||||||
if err != nil && !repo.Backend().IsNotExist(err) {
|
if id == lockID {
|
||||||
t.Fatal(err)
|
exists = true
|
||||||
}
|
}
|
||||||
return err == nil
|
return nil
|
||||||
|
}))
|
||||||
|
|
||||||
|
return exists
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLockWithStaleLock(t *testing.T) {
|
func TestLockWithStaleLock(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue