func TestLockRefresh(t *testing.T) { repo, cleanup := repository.TestRepository(t) defer cleanup() lock, err := restic.NewLock(repo) OK(t, err) var lockID *restic.ID for id := range repo.List(restic.LockFile, nil) { if lockID != nil { t.Error("more than one lock found") } lockID = &id } OK(t, lock.Refresh()) var lockID2 *restic.ID for id := range repo.List(restic.LockFile, nil) { if lockID2 != nil { t.Error("more than one lock found") } lockID2 = &id } Assert(t, !lockID.Equal(*lockID2), "expected a new ID after lock refresh, got the same") OK(t, lock.Unlock()) }