8554: removed testTrashUntrashWithEmptyTrashGoroutine
authorradhika <radhika@curoverse.com>
Tue, 15 Mar 2016 15:27:08 +0000 (11:27 -0400)
committerradhika <radhika@curoverse.com>
Tue, 15 Mar 2016 15:27:08 +0000 (11:27 -0400)
services/keepstore/volume_generic_test.go

index be83151461e366123d7f8608ecdf1edaf00d85d1..c9eb096db98304a95c04a31ffef5ba35ed3ab97b 100644 (file)
@@ -79,7 +79,6 @@ func DoGenericVolumeTests(t TB, factory TestableVolumeFactory) {
 
        testTrashUntrash(t, factory)
        testTrashEmptyTrashUntrash(t, factory)
-       testTrashUntrashWithEmptyTrashGoroutine(t, factory)
 }
 
 // Put a test block, get it and verify content
@@ -952,72 +951,3 @@ func testTrashEmptyTrashUntrash(t TB, factory TestableVolumeFactory) {
        }
        bufs.Put(buf)
 }
-
-// With trashLifetime = 1ns, perform:
-// Run emptyTrash goroutine
-// Trash an old block - which either raises ErrNotImplemented or succeeds
-// Untrash - after emptyTrash goroutine ticks, and hence does not actually untrash
-// Get - which must fail to find the block
-func testTrashUntrashWithEmptyTrashGoroutine(t TB, factory TestableVolumeFactory) {
-       v := factory(t)
-       defer v.Teardown()
-
-       doneEmptyingTrash := make(chan bool)
-       defer func() {
-               trashLifetime = 0 * time.Second
-               doneEmptyingTrash <- true
-       }()
-
-       volumes = append(volumes, v)
-
-       trashLifetime = 1 * time.Nanosecond
-       trashCheckInterval = 1 * time.Nanosecond
-
-       go emptyTrash(doneEmptyingTrash, trashCheckInterval)
-
-       // Trash old block and untrash a little after first trashCheckInterval
-       v.PutRaw(TestHash, TestBlock)
-       v.TouchWithDate(TestHash, time.Now().Add(-2*blobSignatureTTL))
-
-       buf, err := v.Get(TestHash)
-       if err != nil {
-               t.Fatal(err)
-       }
-       if bytes.Compare(buf, TestBlock) != 0 {
-               t.Fatalf("Got data %+q, expected %+q", buf, TestBlock)
-       }
-       bufs.Put(buf)
-
-       // Trash
-       err = v.Trash(TestHash)
-       if err == MethodDisabledError || err == ErrNotImplemented {
-               return
-       }
-
-       _, err = v.Get(TestHash)
-       if err == nil || !os.IsNotExist(err) {
-               t.Fatalf("os.IsNotExist(%v) should have been true", err)
-       }
-
-       time.Sleep(2 * time.Nanosecond)
-
-       // Untrash
-       err = v.Untrash(TestHash)
-       if err != nil {
-               t.Fatal(err)
-       }
-
-       // Get is expected to fail due to EmptyTrash before Untrash
-       // It is still found on readonly volumes
-       buf, err = v.Get(TestHash)
-       if err != nil {
-               if !os.IsNotExist(err) {
-                       t.Errorf("os.IsNotExist(%v) should have been true", err)
-               }
-       } else {
-               if bytes.Compare(buf, TestBlock) != 0 {
-                       t.Errorf("Got data %+q, expected %+q", buf, TestBlock)
-               }
-               bufs.Put(buf)
-       }
-}