func TestLockExclusive(t *testing.T) { repo := SetupRepo() defer TeardownRepo(repo) elock, err := restic.NewExclusiveLock(repo) OK(t, err) OK(t, elock.Unlock()) }
func TestExclusiveLockOnLockedRepo(t *testing.T) { repo := SetupRepo() defer TeardownRepo(repo) elock, err := restic.NewLock(repo) OK(t, err) lock, err := restic.NewExclusiveLock(repo) Assert(t, err != nil, "create normal lock with exclusively locked repo didn't return an error") Assert(t, restic.IsAlreadyLocked(err), "create normal lock with exclusively locked repo didn't return the correct error") OK(t, lock.Unlock()) OK(t, elock.Unlock()) }