[ARVADOS] updated: 3920b0d627ac89687a741b186554c1afd61750f5
git at public.curoverse.com
git at public.curoverse.com
Mon Feb 15 10:50:35 EST 2016
Summary of changes:
services/keepstore/volume_generic_test.go | 62 +++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
via 3920b0d627ac89687a741b186554c1afd61750f5 (commit)
via 581f5f019db485cec8638c24adb8a78990e10bba (commit)
via 7f0aacd7c9e055fd245b1c4516e5f7ec24ebf5e2 (commit)
from 9c2cc3772d61d0930f28942f778b7ca4b096d717 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 3920b0d627ac89687a741b186554c1afd61750f5
Merge: 9c2cc37 581f5f0
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Feb 15 10:49:39 2016 -0500
Merge branch '8178-trash-interface-generic-volume-test' closes #8178
commit 581f5f019db485cec8638c24adb8a78990e10bba
Author: Tom Clegg <tom at curoverse.com>
Date: Thu Feb 4 18:28:43 2016 -0500
8178: Stop accepting zeroed data, now that the s3test bug is fixed.
diff --git a/services/keepstore/volume_generic_test.go b/services/keepstore/volume_generic_test.go
index 975202a..5810411 100644
--- a/services/keepstore/volume_generic_test.go
+++ b/services/keepstore/volume_generic_test.go
@@ -718,7 +718,10 @@ func testTrashUntrash(t TB, factory TestableVolumeFactory) {
buf, err := v.Get(TestHash)
if err != nil {
- t.Errorf("got err %v, expected nil", err)
+ t.Fatal(err)
+ }
+ if bytes.Compare(buf, TestBlock) != 0 {
+ t.Errorf("Got data %+q, expected %+q", buf, TestBlock)
}
bufs.Put(buf)
@@ -726,11 +729,11 @@ func testTrashUntrash(t TB, factory TestableVolumeFactory) {
err = v.Trash(TestHash)
if v.Writable() == false {
if err != MethodDisabledError {
- t.Errorf("Expected MethodDisabledError during Trash from a read-only volume")
+ t.Error(err)
}
} else if err != nil {
if err != ErrNotImplemented {
- t.Errorf("Error during trash: %v", err.Error())
+ t.Error(err)
}
} else {
_, err = v.Get(TestHash)
@@ -741,19 +744,17 @@ func testTrashUntrash(t TB, factory TestableVolumeFactory) {
// Untrash
err = v.Untrash(TestHash)
if err != nil {
- t.Errorf("Error during untrash: %v", err.Error())
+ t.Fatal(err)
}
}
// Get the block - after trash and untrash sequence
- // Backdating block is resulting in emptying out the block in s3 test setup
- // Hence, compare the Get respose with buf (obtained after put, instead of TestBlock)
- buf2, err := v.Get(TestHash)
+ buf, err = v.Get(TestHash)
if err != nil {
- t.Errorf("Error during Get: %v", err.Error())
- } else {
- if bytes.Compare(buf2, buf) != 0 {
- t.Errorf("Got data %+q, expected %+q", buf2, buf)
- }
+ t.Fatal(err)
}
+ if bytes.Compare(buf, TestBlock) != 0 {
+ t.Errorf("Got data %+q, expected %+q", buf, TestBlock)
+ }
+ bufs.Put(buf)
}
commit 7f0aacd7c9e055fd245b1c4516e5f7ec24ebf5e2
Author: radhika <radhika at curoverse.com>
Date: Tue Jan 26 23:31:27 2016 -0500
8178: add generic volume tests for trash / untrash interface.
diff --git a/services/keepstore/volume_generic_test.go b/services/keepstore/volume_generic_test.go
index e168940..975202a 100644
--- a/services/keepstore/volume_generic_test.go
+++ b/services/keepstore/volume_generic_test.go
@@ -76,6 +76,8 @@ func DoGenericVolumeTests(t TB, factory TestableVolumeFactory) {
testPutConcurrent(t, factory)
testPutFullBlock(t, factory)
+
+ testTrashUntrash(t, factory)
}
// Put a test block, get it and verify content
@@ -696,3 +698,62 @@ func testPutFullBlock(t TB, factory TestableVolumeFactory) {
t.Error("rdata != wdata")
}
}
+
+// With trashLifetime != 0, perform:
+// Trash an old block - which either raises ErrNotImplemented or succeeds
+// Untrash - which either raises ErrNotImplemented or succeeds
+// Get - which must succeed
+func testTrashUntrash(t TB, factory TestableVolumeFactory) {
+ v := factory(t)
+ defer v.Teardown()
+ defer func() {
+ trashLifetime = 0
+ }()
+
+ trashLifetime = 3600 * time.Second
+
+ // put block and backdate it
+ v.PutRaw(TestHash, TestBlock)
+ v.TouchWithDate(TestHash, time.Now().Add(-2*blobSignatureTTL))
+
+ buf, err := v.Get(TestHash)
+ if err != nil {
+ t.Errorf("got err %v, expected nil", err)
+ }
+ bufs.Put(buf)
+
+ // Trash
+ err = v.Trash(TestHash)
+ if v.Writable() == false {
+ if err != MethodDisabledError {
+ t.Errorf("Expected MethodDisabledError during Trash from a read-only volume")
+ }
+ } else if err != nil {
+ if err != ErrNotImplemented {
+ t.Errorf("Error during trash: %v", err.Error())
+ }
+ } else {
+ _, err = v.Get(TestHash)
+ if err == nil || !os.IsNotExist(err) {
+ t.Errorf("os.IsNotExist(%v) should have been true", err)
+ }
+
+ // Untrash
+ err = v.Untrash(TestHash)
+ if err != nil {
+ t.Errorf("Error during untrash: %v", err.Error())
+ }
+ }
+
+ // Get the block - after trash and untrash sequence
+ // Backdating block is resulting in emptying out the block in s3 test setup
+ // Hence, compare the Get respose with buf (obtained after put, instead of TestBlock)
+ buf2, err := v.Get(TestHash)
+ if err != nil {
+ t.Errorf("Error during Get: %v", err.Error())
+ } else {
+ if bytes.Compare(buf2, buf) != 0 {
+ t.Errorf("Got data %+q, expected %+q", buf2, buf)
+ }
+ }
+}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list