From b242b0a0785aa2fdf195b603faffece87dd8059f Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 19 Sep 2019 16:53:48 +0100 Subject: [PATCH] lib/cache,rc/jobs: make tests more reliable --- fs/rc/jobs/job_test.go | 2 +- lib/cache/cache_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/rc/jobs/job_test.go b/fs/rc/jobs/job_test.go index bc1ec6b20..fd40a44be 100644 --- a/fs/rc/jobs/job_test.go +++ b/fs/rc/jobs/job_test.go @@ -51,7 +51,7 @@ func TestJobsExpire(t *testing.T) { assert.Equal(t, true, jobs.expireRunning) job.mu.Unlock() jobs.mu.Unlock() - time.Sleep(10 * time.Millisecond) + time.Sleep(250 * time.Millisecond) jobs.mu.Lock() assert.Equal(t, false, jobs.expireRunning) assert.Equal(t, 0, len(jobs.jobs)) diff --git a/lib/cache/cache_test.go b/lib/cache/cache_test.go index 8c098f7f9..cfdc28023 100644 --- a/lib/cache/cache_test.go +++ b/lib/cache/cache_test.go @@ -115,7 +115,7 @@ func TestCacheExpire(t *testing.T) { entry.lastUsed = time.Now().Add(-c.expireDuration - 60*time.Second) assert.Equal(t, true, c.expireRunning) c.mu.Unlock() - time.Sleep(10 * time.Millisecond) + time.Sleep(250 * time.Millisecond) c.mu.Lock() assert.Equal(t, false, c.expireRunning) assert.Equal(t, 0, len(c.cache))