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.
This commit is contained in:
Michael Eischer 2023-07-09 15:18:16 +02:00
parent 6a436d731d
commit 399f8e84a1

View file

@ -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
}