forked from TrueCloudLab/restic
cache: move to backend package
This commit is contained in:
parent
80132e71d8
commit
8e5d7d719c
15 changed files with 6 additions and 6 deletions
31
internal/backend/cache/dir_test.go
vendored
Normal file
31
internal/backend/cache/dir_test.go
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
package cache
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
rtest "github.com/restic/restic/internal/test"
|
||||
)
|
||||
|
||||
// DefaultDir should honor RESTIC_CACHE_DIR on all platforms.
|
||||
func TestCacheDirEnv(t *testing.T) {
|
||||
cachedir := os.Getenv("RESTIC_CACHE_DIR")
|
||||
|
||||
if cachedir == "" {
|
||||
cachedir = "/doesnt/exist"
|
||||
err := os.Setenv("RESTIC_CACHE_DIR", cachedir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() {
|
||||
err := os.Unsetenv("RESTIC_CACHE_DIR")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
dir, err := DefaultDir()
|
||||
rtest.Equals(t, cachedir, dir)
|
||||
rtest.OK(t, err)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue