From 16b7cc7655db2323addfbf1dbce8800cd03f6c58 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 23 Jan 2016 17:45:33 +0100 Subject: [PATCH] Remove redundant local tests --- backend/local_test.go | 59 ------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 backend/local_test.go diff --git a/backend/local_test.go b/backend/local_test.go deleted file mode 100644 index 462c4c3d6..000000000 --- a/backend/local_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package backend_test - -import ( - "fmt" - "io/ioutil" - "testing" - - "github.com/restic/restic/backend" - "github.com/restic/restic/backend/local" - . "github.com/restic/restic/test" -) - -func setupLocalBackend(t *testing.T) *local.Local { - tempdir, err := ioutil.TempDir("", "restic-test-") - OK(t, err) - - b, err := local.Create(tempdir) - OK(t, err) - - t.Logf("created local backend at %s", tempdir) - - return b -} - -func teardownLocalBackend(t *testing.T, b *local.Local) { - if !TestCleanup { - t.Logf("leaving local backend at %s\n", b.Location()) - return - } - - OK(t, b.Delete()) -} - -func TestLocalBackend(t *testing.T) { - // test for non-existing backend - b, err := local.Open("/invalid-restic-test") - Assert(t, err != nil, "opening invalid repository at /invalid-restic-test should have failed, but err is nil") - Assert(t, b == nil, fmt.Sprintf("opening invalid repository at /invalid-restic-test should have failed, but b is not nil: %v", b)) - - s := setupLocalBackend(t) - defer teardownLocalBackend(t, s) - - testBackend(s, t) -} - -func TestLocalBackendCreationFailures(t *testing.T) { - b := setupLocalBackend(t) - defer teardownLocalBackend(t, b) - - // create a fake config file - blob, err := b.Create() - OK(t, err) - fmt.Fprintf(blob, "config\n") - OK(t, blob.Finalize(backend.Config, "")) - - // test failure to create a new repository at the same location - b2, err := local.Create(b.Location()) - Assert(t, err != nil && b2 == nil, fmt.Sprintf("creating a repository at %s for the second time should have failed", b.Location())) -}