Add temporary files repositories in integration tests

This is intended to catch problems with temporary files stored in the
backend, even if the responsible component forgets to test for those.
This commit is contained in:
Michael Eischer 2024-08-29 16:33:18 +02:00
parent 1f4c9d2806
commit 361fbbf58f

View file

@ -2,6 +2,8 @@ package main
import (
"context"
"os"
"path/filepath"
"testing"
"github.com/restic/restic/internal/repository"
@ -16,6 +18,11 @@ func testRunInit(t testing.TB, opts GlobalOptions) {
rtest.OK(t, runInit(context.TODO(), InitOptions{}, opts, nil))
t.Logf("repository initialized at %v", opts.Repo)
// create temporary junk files to verify that restic does not trip over them
for _, path := range []string{"index", "snapshots", "keys", "locks", filepath.Join("data", "00")} {
rtest.OK(t, os.WriteFile(filepath.Join(opts.Repo, path, "tmp12345"), []byte("junk file"), 0o600))
}
}
func TestInitCopyChunkerParams(t *testing.T) {