Documentation ¶
Overview ¶
Package test provides helper functions for writing tests for restic.
Index ¶
- Variables
- func Assert(tb testing.TB, condition bool, msg string, v ...interface{})
- func Env(t testing.TB, repoFixture string) (repodir string, cleanup func())
- func Equals(tb testing.TB, exp, act interface{})
- func OK(tb testing.TB, err error)
- func OKs(tb testing.TB, errs []error)
- func Random(seed, count int) []byte
- func RemoveAll(t testing.TB, path string)
- func ResetReadOnly(t testing.TB, dir string)
- func SetupTarTestFixture(t testing.TB, outputDir, tarFile string)
- func SkipDisallowed(t testing.TB, name string)
- func TempDir(t testing.TB) (path string, cleanup func())
Constants ¶
This section is empty.
Variables ¶
var ( TestPassword = getStringVar("RESTIC_TEST_PASSWORD", "geheim") TestCleanupTempDirs = 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:/usr/libexec") TestWalkerPath = getStringVar("RESTIC_TEST_PATH", ".") BenchArchiveDirectory = getStringVar("RESTIC_BENCH_DIR", ".") TestS3Server = getStringVar("RESTIC_TEST_S3_SERVER", "") TestRESTServer = getStringVar("RESTIC_TEST_REST_SERVER", "") TestIntegrationDisallowSkip = getStringVar("RESTIC_TEST_DISALLOW_SKIP", "") )
Functions ¶
func Env ¶
Env creates a test environment and extracts the repository fixture. Returned is the repo path and a cleanup function.
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 SetupTarTestFixture ¶
SetupTarTestFixture extracts the tarFile to outputDir.
func SkipDisallowed ¶
SkipDisallowed fails the test if it needs to run. The environment variable RESTIC_TEST_DISALLOW_SKIP contains a comma-separated list of test names that must be run. If name is in this list, the test is marked as failed.
Types ¶
This section is empty.