From 399f8e84a11e12ff5b2c9840f8581048829d9a5f Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 9 Jul 2023 15:18:16 +0200 Subject: [PATCH] lock: use mem backend for locking tests This hopefully fixes the timing related test failures which appear to be caused by very slow fsync calls. --- cmd/restic/lock_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/restic/lock_test.go b/cmd/restic/lock_test.go index 31911c027..91b90db4f 100644 --- a/cmd/restic/lock_test.go +++ b/cmd/restic/lock_test.go @@ -8,6 +8,8 @@ import ( "testing" "time" + "github.com/restic/restic/internal/backend/location" + "github.com/restic/restic/internal/backend/mem" "github.com/restic/restic/internal/repository" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/test" @@ -15,6 +17,12 @@ import ( func openLockTestRepo(t *testing.T, wrapper backendWrapper) (*repository.Repository, func(), *testEnvironment) { env, cleanup := withTestEnvironment(t) + + reg := location.NewRegistry() + reg.Register(mem.NewFactory()) + env.gopts.backends = reg + env.gopts.Repo = "mem:" + if wrapper != nil { env.gopts.backendTestHook = wrapper }