Documentation ¶
Overview ¶
Package test_helper provides helper functions for writing tests for restic.
Index ¶
- Variables
- func Assert(tb testing.TB, condition bool, msg string, v ...interface{})
- func Equals(tb testing.TB, exp, act interface{})
- func OK(tb testing.TB, err error)
- func OKs(tb testing.TB, errs []error)
- func OpenLocalRepo(t testing.TB, dir string) *repository.Repository
- func ParseID(s string) backend.ID
- func Random(seed, count int) []byte
- func RandomReader(seed, size int) *bytes.Reader
- func RemoveAll(t testing.TB, path string)
- func ResetReadOnly(t testing.TB, dir string)
- func SetupRepo() *repository.Repository
- func SetupTarTestFixture(t testing.TB, outputDir, tarFile string)
- func SnapshotDir(t testing.TB, repo *repository.Repository, path string, parent *backend.ID) *restic.Snapshot
- func TeardownRepo(repo *repository.Repository)
- func WithRepo(t testing.TB, f func(*repository.Repository))
- func WithTestEnvironment(t testing.TB, repoFixture string, f func(repodir string))
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TestPassword = getStringVar("RESTIC_TEST_PASSWORD", "geheim") TestCleanup = getBoolVar("RESTIC_TEST_CLEANUP", true) TestTempDir = getStringVar("RESTIC_TEST_TMPDIR", "") RunIntegrationTest = getBoolVar("RESTIC_TEST_INTEGRATION", true) RunFuseTest = getBoolVar("RESTIC_TEST_FUSE", true) TestSFTPPath = getStringVar("RESTIC_TEST_SFTPPATH", "/usr/lib/ssh:/usr/lib/openssh") TestWalkerPath = getStringVar("RESTIC_TEST_PATH", ".") BenchArchiveDirectory = getStringVar("RESTIC_BENCH_DIR", ".") )
Functions ¶
func OpenLocalRepo ¶
func OpenLocalRepo(t testing.TB, dir string) *repository.Repository
OpenLocalRepo opens the local repository located at dir.
func RandomReader ¶
RandomReader returns a reader that returns size bytes of pseudo-random data derived from the seed.
func RemoveAll ¶
RemoveAll recursively resets the read-only flag of all files and dirs and afterwards uses os.RemoveAll() to remove the path.
func ResetReadOnly ¶
ResetReadOnly recursively resets the read-only flag recursively for dir. This is mainly used for tests on Windows, which is unable to delete a file set read-only.
func SetupRepo ¶
func SetupRepo() *repository.Repository
func SetupTarTestFixture ¶
SetupTarTestFixture extracts the tarFile to outputDir.
func SnapshotDir ¶
func SnapshotDir(t testing.TB, repo *repository.Repository, path string, parent *backend.ID) *restic.Snapshot
func TeardownRepo ¶
func TeardownRepo(repo *repository.Repository)
func WithRepo ¶
func WithRepo(t testing.TB, f func(*repository.Repository))
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.