2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 23:06:32 +00:00

Use bigger offset in test to avoid random test failures.

Since Windows cannot to a SIGHUP test to check if a process is live,
the test will fail because the lock isn't detected as stale if a process with
that ID exists. Process IDs are re-used agressively on Windows, so add 500000 makes
the test extremely unlikely (if not impossible) to fail.
This commit is contained in:
Klaus Post 2015-08-14 15:19:45 +02:00
parent 3504ea3992
commit 3804bc7493

View File

@ -124,7 +124,7 @@ var staleLockTests = []struct {
{ {
timestamp: time.Now(), timestamp: time.Now(),
stale: true, stale: true,
pid: os.Getpid() + 500, pid: os.Getpid() + 500000,
}, },
} }
@ -158,7 +158,7 @@ func TestLockWithStaleLock(t *testing.T) {
id2, err := createFakeLock(repo, time.Now().Add(-time.Minute), os.Getpid()) id2, err := createFakeLock(repo, time.Now().Add(-time.Minute), os.Getpid())
OK(t, err) OK(t, err)
id3, err := createFakeLock(repo, time.Now().Add(-time.Minute), os.Getpid()+500) id3, err := createFakeLock(repo, time.Now().Add(-time.Minute), os.Getpid()+500000)
OK(t, err) OK(t, err)
OK(t, restic.RemoveStaleLocks(repo)) OK(t, restic.RemoveStaleLocks(repo))