mirror of https://github.com/restic/restic.git
parent
bd25620880
commit
ad1f844cea
|
@ -5,8 +5,8 @@ import (
|
|||
"context"
|
||||
"testing"
|
||||
|
||||
_restic "github.com/restic/restic"
|
||||
"github.com/restic/restic/internal/archiver"
|
||||
"github.com/restic/restic/internal/fs"
|
||||
"github.com/restic/restic/internal/repository"
|
||||
"github.com/restic/restic/internal/restic"
|
||||
rtest "github.com/restic/restic/internal/test"
|
||||
|
@ -67,14 +67,13 @@ func WriteTest(t *testing.T, format string, cd CheckDump) {
|
|||
target: "/",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
tmpdir, repo := prepareTempdirRepoSrc(t, tt.args)
|
||||
arch := _restic.Archiver(repo)
|
||||
arch := archiver.New(repo, fs.Track{FS: fs.Local{}}, archiver.Options{})
|
||||
|
||||
back := rtest.Chdir(t, tmpdir)
|
||||
defer back()
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/internal/errors"
|
||||
|
||||
mrand "math/rand"
|
||||
|
@ -195,7 +194,7 @@ func RemoveAll(t testing.TB, path string) {
|
|||
// TempDir returns a temporary directory that is removed by t.Cleanup,
|
||||
// except if TestCleanupTempDirs is set to false.
|
||||
func TempDir(t testing.TB) string {
|
||||
tempdir, err := restic.ResticDir(TestTempDir, "restic-test-")
|
||||
tempdir, err := os.MkdirTemp(TestTempDir, "restic-test-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
17
sdk.go
17
sdk.go
|
@ -1,17 +0,0 @@
|
|||
package restic
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/restic/restic/internal/archiver"
|
||||
"github.com/restic/restic/internal/fs"
|
||||
"github.com/restic/restic/internal/restic"
|
||||
)
|
||||
|
||||
func ResticDir(d string, n string) (string, error) {
|
||||
return os.MkdirTemp(d, n)
|
||||
}
|
||||
|
||||
func Archiver(repo restic.Repository) *archiver.Archiver {
|
||||
return archiver.New(repo, fs.Track{FS: fs.Local{}}, archiver.Options{})
|
||||
}
|
Loading…
Reference in New Issue