[ARVADOS] updated: fdbf2ead3452bf7c8ba8f3f275cf486339b5406e
git at public.curoverse.com
git at public.curoverse.com
Wed Sep 23 16:45:40 EDT 2015
Summary of changes:
sdk/python/arvados/arvfile.py | 20 +++++----
sdk/python/tests/test_arvfile.py | 15 +++++++
...est.go => handlers_with_generic_volume_test.go} | 48 +++++++++++-----------
services/keepstore/volume_unix_test.go | 8 ++--
4 files changed, 56 insertions(+), 35 deletions(-)
rename services/keepstore/{volume_keepstore_generic_test.go => handlers_with_generic_volume_test.go} (74%)
via fdbf2ead3452bf7c8ba8f3f275cf486339b5406e (commit)
via a3e32a2f4a702c076d46a5b19305dd20a1ee3012 (commit)
via 009c08b43affdefa6f2825059a971c750b90e222 (commit)
via d4f15342fcaabb0bec0165b2abdf040c88c08229 (commit)
via 16edd7c54ac58cda991d3e9f0a1b48cea3dd985c (commit)
via b16358fa5145d3d4bcd0ac37bd81d7605eac040f (commit)
from 43748be08c5d67171cb2f5565670dd0eef889b07 (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 fdbf2ead3452bf7c8ba8f3f275cf486339b5406e
Author: radhika <radhika at curoverse.com>
Date: Wed Sep 23 16:29:02 2015 -0400
7329: improved TestableVolumeManagerFactory method signature, teardown logic, comments and test file name.
diff --git a/services/keepstore/volume_keepstore_generic_test.go b/services/keepstore/handlers_with_generic_volume_test.go
similarity index 74%
rename from services/keepstore/volume_keepstore_generic_test.go
rename to services/keepstore/handlers_with_generic_volume_test.go
index 0e5df5b..90094f3 100644
--- a/services/keepstore/volume_keepstore_generic_test.go
+++ b/services/keepstore/handlers_with_generic_volume_test.go
@@ -5,15 +5,16 @@ import (
"testing"
)
-// A TestableVolumeManagerFactory creates a volume manager with one or more TestableVolumes.
-// The factory function, and the TestableVolumes it returns, can use "t" to write
+// A TestableVolumeManagerFactory creates a volume manager with at least two TestableVolume instances.
+// The factory function, and the TestableVolume instances it returns, can use "t" to write
// logs, fail the current test, etc.
-type TestableVolumeManagerFactory func(t *testing.T) []TestableVolume
+type TestableVolumeManagerFactory func(t *testing.T) (*RRVolumeManager, []TestableVolume)
-// DoGenericVolumeTests runs a set of tests that every TestableVolume
-// is expected to pass. It calls factory to create a new TestableVolume
-// for each test case, to avoid leaking state between tests.
-func DoGenericVolumeFunctionalTests(t *testing.T, factory TestableVolumeManagerFactory) {
+// DoHandlersWithGenericVolumeTests runs a set of handler tests with a
+// Volume Manager comprised of TestableVolume instances.
+// It calls factory to create a volume manager with TestableVolume
+// instances for each test case, to avoid leaking state between tests.
+func DoHandlersWithGenericVolumeTests(t *testing.T, factory TestableVolumeManagerFactory) {
testGetBlock(t, factory, TestHash, TestBlock)
testGetBlock(t, factory, EmptyHash, EmptyBlock)
testPutRawBadDataGetBlock(t, factory, TestHash, TestBlock, []byte("baddata"))
@@ -24,12 +25,22 @@ func DoGenericVolumeFunctionalTests(t *testing.T, factory TestableVolumeManagerF
testPutBlockCorrupt(t, factory, EmptyHash, EmptyBlock, []byte("baddata"))
}
+// Setup RRVolumeManager with TestableVolumes
+func setupHandlersWithGenericVolumeTest(t *testing.T, factory TestableVolumeManagerFactory) []TestableVolume {
+ vm, testableVolumes := factory(t)
+ KeepVM = vm
+
+ for _, v := range testableVolumes {
+ defer v.Teardown()
+ }
+ defer KeepVM.Close()
+
+ return testableVolumes
+}
+
// Put a block using PutRaw in just one volume and Get it using GetBlock
func testGetBlock(t *testing.T, factory TestableVolumeManagerFactory, testHash string, testBlock []byte) {
- testableVolumes := factory(t)
- defer testableVolumes[0].Teardown()
- defer testableVolumes[1].Teardown()
- defer KeepVM.Close()
+ testableVolumes := setupHandlersWithGenericVolumeTest(t, factory)
// Put testBlock in one volume
testableVolumes[1].PutRaw(testHash, testBlock)
@@ -47,10 +58,7 @@ func testGetBlock(t *testing.T, factory TestableVolumeManagerFactory, testHash s
// Put a bad block using PutRaw and get it.
func testPutRawBadDataGetBlock(t *testing.T, factory TestableVolumeManagerFactory,
testHash string, testBlock []byte, badData []byte) {
- testableVolumes := factory(t)
- defer testableVolumes[0].Teardown()
- defer testableVolumes[1].Teardown()
- defer KeepVM.Close()
+ testableVolumes := setupHandlersWithGenericVolumeTest(t, factory)
// Put bad data for testHash in both volumes
testableVolumes[0].PutRaw(testHash, badData)
@@ -65,10 +73,7 @@ func testPutRawBadDataGetBlock(t *testing.T, factory TestableVolumeManagerFactor
// Invoke PutBlock twice to ensure CompareAndTouch path is tested.
func testPutBlock(t *testing.T, factory TestableVolumeManagerFactory, testHash string, testBlock []byte) {
- testableVolumes := factory(t)
- defer testableVolumes[0].Teardown()
- defer testableVolumes[1].Teardown()
- defer KeepVM.Close()
+ setupHandlersWithGenericVolumeTest(t, factory)
// PutBlock
if err := PutBlock(testBlock, testHash); err != nil {
@@ -92,10 +97,7 @@ func testPutBlock(t *testing.T, factory TestableVolumeManagerFactory, testHash s
// Put a bad block using PutRaw, overwrite it using PutBlock and get it.
func testPutBlockCorrupt(t *testing.T, factory TestableVolumeManagerFactory,
testHash string, testBlock []byte, badData []byte) {
- testableVolumes := factory(t)
- defer testableVolumes[0].Teardown()
- defer testableVolumes[1].Teardown()
- defer KeepVM.Close()
+ testableVolumes := setupHandlersWithGenericVolumeTest(t, factory)
// Put bad data for testHash in both volumes
testableVolumes[0].PutRaw(testHash, badData)
diff --git a/services/keepstore/volume_unix_test.go b/services/keepstore/volume_unix_test.go
index dd6214d..924637f 100644
--- a/services/keepstore/volume_unix_test.go
+++ b/services/keepstore/volume_unix_test.go
@@ -86,8 +86,8 @@ func TestUnixVolumeWithGenericTestsSerialized(t *testing.T) {
}
// serialize = false; readonly = false
-func TestUnixVolumeManagerWithGenericTests(t *testing.T) {
- DoGenericVolumeFunctionalTests(t, func(t *testing.T) []TestableVolume {
+func TestUnixVolumeHandlersWithGenericVolumeTests(t *testing.T) {
+ DoHandlersWithGenericVolumeTests(t, func(t *testing.T) (*RRVolumeManager, []TestableVolume) {
vols := make([]Volume, 2)
testableUnixVols := make([]TestableVolume, 2)
@@ -97,9 +97,7 @@ func TestUnixVolumeManagerWithGenericTests(t *testing.T) {
testableUnixVols[i] = v
}
- KeepVM = MakeRRVolumeManager(vols)
-
- return testableUnixVols
+ return MakeRRVolumeManager(vols), testableUnixVols
})
}
commit a3e32a2f4a702c076d46a5b19305dd20a1ee3012
Merge: 43748be 009c08b
Author: radhika <radhika at curoverse.com>
Date: Wed Sep 23 15:44:09 2015 -0400
Merge branch 'master' into 7329-empty-block-issue
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list