forked from TrueCloudLab/restic
Remove unreliable tests
This commit is contained in:
parent
e657287eac
commit
0f09a7e46e
1 changed files with 0 additions and 77 deletions
77
lock_test.go
77
lock_test.go
|
@ -2,7 +2,6 @@ package restic_test
|
|||
|
||||
import (
|
||||
"os"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -196,79 +195,3 @@ func TestRemoveAllLocks(t *testing.T) {
|
|||
Assert(t, lockExists(repo, t, id3) == false,
|
||||
"lock still exists after RemoveAllLocks was called")
|
||||
}
|
||||
|
||||
func TestLockConflictingExclusiveLocks(t *testing.T) {
|
||||
repo := SetupRepo()
|
||||
defer TeardownRepo(repo)
|
||||
|
||||
for _, jobs := range []int{5, 23, 200} {
|
||||
var wg sync.WaitGroup
|
||||
errch := make(chan error, jobs)
|
||||
|
||||
f := func() {
|
||||
defer wg.Done()
|
||||
|
||||
lock, err := restic.NewExclusiveLock(repo)
|
||||
errch <- err
|
||||
OK(t, lock.Unlock())
|
||||
}
|
||||
|
||||
for i := 0; i < jobs; i++ {
|
||||
wg.Add(1)
|
||||
go f()
|
||||
}
|
||||
|
||||
errors := 0
|
||||
for i := 0; i < jobs; i++ {
|
||||
err := <-errch
|
||||
if err != nil {
|
||||
errors++
|
||||
}
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
Assert(t, errors == jobs-1,
|
||||
"Expected %d errors, got %d", jobs-1, errors)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLockConflictingLocks(t *testing.T) {
|
||||
repo := SetupRepo()
|
||||
defer TeardownRepo(repo)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
||||
errch := make(chan error, 2)
|
||||
|
||||
wg.Add(2)
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
lock, err := restic.NewExclusiveLock(repo)
|
||||
errch <- err
|
||||
OK(t, lock.Unlock())
|
||||
}()
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
lock, err := restic.NewLock(repo)
|
||||
errch <- err
|
||||
OK(t, lock.Unlock())
|
||||
}()
|
||||
|
||||
errors := 0
|
||||
for i := 0; i < 2; i++ {
|
||||
err := <-errch
|
||||
if err != nil {
|
||||
errors++
|
||||
}
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
Assert(t, errors == 1,
|
||||
"Expected exactly one errors, got %d", errors)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue