[ARVADOS] updated: b9e48b6cbfff91b05af44cf1410120468a385aba

git at public.curoverse.com git at public.curoverse.com
Fri Sep 11 19:19:32 EDT 2015


Summary of changes:
 services/arv-git-httpd/server_test.go     |  4 +-
 services/keepstore/volume_generic_test.go | 62 ++++++++++++++++---------------
 services/keepstore/volume_unix_test.go    | 24 ++++++++++++
 3 files changed, 59 insertions(+), 31 deletions(-)

       via  b9e48b6cbfff91b05af44cf1410120468a385aba (commit)
       via  8781021a9ab265b225f0f1eaef6170abde9ce3c3 (commit)
       via  8550361e090670395e9f079e7718974b17fc0f5d (commit)
       via  d805ea58fa7f4fce9e457df7073b1b414249d2ed (commit)
       via  21047149d6b42845f563a480b5067b9e4b0d895c (commit)
      from  143a5f355100b837daa428231df0370b525a1f9f (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 b9e48b6cbfff91b05af44cf1410120468a385aba
Author: radhika <radhika at curoverse.com>
Date:   Fri Sep 11 19:18:27 2015 -0400

    7179: add TestUnixVolumeWithGenericTestsSerialized and some more updates.

diff --git a/services/keepstore/volume_generic_test.go b/services/keepstore/volume_generic_test.go
index 5f68ef8..9e2e6c6 100644
--- a/services/keepstore/volume_generic_test.go
+++ b/services/keepstore/volume_generic_test.go
@@ -48,8 +48,8 @@ func DoGenericVolumeTests(t *testing.T, factory TestableVolumeFactory) {
 
 	testWritableTrue(t, factory)
 
-	testGetSerialized(t, factory)
-	testPutSerialized(t, factory)
+	testGetConcurrent(t, factory)
+	testPutConcurrent(t, factory)
 }
 
 // DoGenericReadOnlyVolumeTests runs a set of tests that every
@@ -71,6 +71,9 @@ func testGet(t *testing.T, factory TestableVolumeFactory) {
 	if err != nil {
 		t.Error(err)
 	}
+
+	bufs.Put(buf)
+
 	if bytes.Compare(buf, TEST_BLOCK) != 0 {
 		t.Errorf("expected %s, got %s", string(TEST_BLOCK), string(buf))
 	}
@@ -198,23 +201,29 @@ func testPutMultipleBlocks(t *testing.T, factory TestableVolumeFactory) {
 		t.Errorf("Got err putting block %q: %q, expected nil", TEST_BLOCK_3, err)
 	}
 
-	if data, err := v.Get(TEST_HASH); err != nil {
+	data, err := v.Get(TEST_HASH)
+	if err != nil {
 		t.Error(err)
 	} else if bytes.Compare(data, TEST_BLOCK) != 0 {
 		t.Errorf("Block present, but content is incorrect: Expected: %v  Found: %v", data, TEST_BLOCK)
 	}
+	bufs.Put(data)
 
-	if data, err := v.Get(TEST_HASH_2); err != nil {
+	data, err = v.Get(TEST_HASH_2)
+	if err != nil {
 		t.Error(err)
 	} else if bytes.Compare(data, TEST_BLOCK_2) != 0 {
 		t.Errorf("Block present, but content is incorrect: Expected: %v  Found: %v", data, TEST_BLOCK_2)
 	}
+	bufs.Put(data)
 
-	if data, err := v.Get(TEST_HASH_3); err != nil {
+	data, err = v.Get(TEST_HASH_3)
+	if err != nil {
 		t.Error(err)
 	} else if bytes.Compare(data, TEST_BLOCK_3) != 0 {
 		t.Errorf("Block present, but content is incorrect: Expected: %v  Found: %v", data, TEST_BLOCK_3)
 	}
+	bufs.Put(data)
 }
 
 // testPutAndTouch
@@ -261,11 +270,7 @@ func testTouchNoSuchBlock(t *testing.T, factory TestableVolumeFactory) {
 	v := factory(t)
 	defer v.Teardown()
 
-	if err := v.Put(TEST_HASH, TEST_BLOCK); err != nil {
-		t.Error(err)
-	}
-
-	if err := v.Touch(TEST_HASH); err != nil {
+	if err := v.Touch(TEST_HASH); err == nil {
 		t.Error("Expected error when attempted to touch a non-existing block")
 	}
 }
@@ -341,11 +346,13 @@ func testDeleteNewBlock(t *testing.T, factory TestableVolumeFactory) {
 	if err := v.Delete(TEST_HASH); err != nil {
 		t.Error(err)
 	}
-	if data, err := v.Get(TEST_HASH); err != nil {
+	data, err := v.Get(TEST_HASH)
+	if err != nil {
 		t.Error(err)
 	} else if bytes.Compare(data, TEST_BLOCK) != 0 {
 		t.Error("Block still present, but content is incorrect: %+v != %+v", data, TEST_BLOCK)
 	}
+	bufs.Put(data)
 }
 
 // Calling Delete() for a block with a timestamp older than
@@ -437,10 +444,14 @@ func testUpdateReadOnly(t *testing.T, factory TestableVolumeFactory) {
 		t.Errorf("got err %v, expected nil", err)
 	}
 
-	err = v.Put(TEST_HASH, TEST_BLOCK)
+	err = v.Put(TEST_HASH_2, TEST_BLOCK_2)
 	if err == nil {
 		t.Errorf("Expected error when putting block in a read-only volume")
 	}
+	_, err = v.Get(TEST_HASH_2)
+	if err == nil {
+		t.Errorf("Expected error when getting block whose put in read-only volume failed")
+	}
 
 	err = v.Touch(TEST_HASH)
 	if err == nil {
@@ -453,22 +464,8 @@ func testUpdateReadOnly(t *testing.T, factory TestableVolumeFactory) {
 	}
 }
 
-// Serialization tests: launch a bunch of concurrent
-//
-// TODO(twp): show that the underlying Read/Write operations executed
-// serially and not concurrently. The easiest way to do this is
-// probably to activate verbose or debug logging, capture log output
-// and examine it to confirm that Reads and Writes did not overlap.
-//
-// TODO(twp): a proper test of I/O serialization requires that a
-// second request start while the first one is still underway.
-// Guaranteeing that the test behaves this way requires some tricky
-// synchronization and mocking.  For now we'll just launch a bunch of
-// requests simultaenously in goroutines and demonstrate that they
-// return accurate results.
-//
-
-func testGetSerialized(t *testing.T, factory TestableVolumeFactory) {
+// Launch concurrent Gets
+func testGetConcurrent(t *testing.T, factory TestableVolumeFactory) {
 	v := factory(t)
 	defer v.Teardown()
 
@@ -482,6 +479,7 @@ func testGetSerialized(t *testing.T, factory TestableVolumeFactory) {
 		if err != nil {
 			t.Errorf("err1: %v", err)
 		}
+		bufs.Put(buf)
 		if bytes.Compare(buf, TEST_BLOCK) != 0 {
 			t.Errorf("buf should be %s, is %s", string(TEST_BLOCK), string(buf))
 		}
@@ -493,6 +491,7 @@ func testGetSerialized(t *testing.T, factory TestableVolumeFactory) {
 		if err != nil {
 			t.Errorf("err2: %v", err)
 		}
+		bufs.Put(buf)
 		if bytes.Compare(buf, TEST_BLOCK_2) != 0 {
 			t.Errorf("buf should be %s, is %s", string(TEST_BLOCK_2), string(buf))
 		}
@@ -504,6 +503,7 @@ func testGetSerialized(t *testing.T, factory TestableVolumeFactory) {
 		if err != nil {
 			t.Errorf("err3: %v", err)
 		}
+		bufs.Put(buf)
 		if bytes.Compare(buf, TEST_BLOCK_3) != 0 {
 			t.Errorf("buf should be %s, is %s", string(TEST_BLOCK_3), string(buf))
 		}
@@ -516,7 +516,8 @@ func testGetSerialized(t *testing.T, factory TestableVolumeFactory) {
 	}
 }
 
-func testPutSerialized(t *testing.T, factory TestableVolumeFactory) {
+// Launch concurrent Puts
+func testPutConcurrent(t *testing.T, factory TestableVolumeFactory) {
 	v := factory(t)
 	defer v.Teardown()
 
@@ -555,6 +556,7 @@ func testPutSerialized(t *testing.T, factory TestableVolumeFactory) {
 	if err != nil {
 		t.Errorf("Get #1: %v", err)
 	}
+	bufs.Put(buf)
 	if bytes.Compare(buf, TEST_BLOCK) != 0 {
 		t.Errorf("Get #1: expected %s, got %s", string(TEST_BLOCK), string(buf))
 	}
@@ -563,6 +565,7 @@ func testPutSerialized(t *testing.T, factory TestableVolumeFactory) {
 	if err != nil {
 		t.Errorf("Get #2: %v", err)
 	}
+	bufs.Put(buf)
 	if bytes.Compare(buf, TEST_BLOCK_2) != 0 {
 		t.Errorf("Get #2: expected %s, got %s", string(TEST_BLOCK_2), string(buf))
 	}
@@ -571,6 +574,7 @@ func testPutSerialized(t *testing.T, factory TestableVolumeFactory) {
 	if err != nil {
 		t.Errorf("Get #3: %v", err)
 	}
+	bufs.Put(buf)
 	if bytes.Compare(buf, TEST_BLOCK_3) != 0 {
 		t.Errorf("Get #3: expected %s, got %s", string(TEST_BLOCK_3), string(buf))
 	}
diff --git a/services/keepstore/volume_unix_test.go b/services/keepstore/volume_unix_test.go
index 7fea560..f23a9c9 100644
--- a/services/keepstore/volume_unix_test.go
+++ b/services/keepstore/volume_unix_test.go
@@ -70,12 +70,24 @@ func TestUnixVolumeWithGenericTests(t *testing.T) {
 	})
 }
 
+func TestUnixVolumeWithGenericTestsSerialized(t *testing.T) {
+	DoGenericVolumeTests(t, func(t *testing.T) TestableVolume {
+		return NewTestableUnixVolume(t, true, false)
+	})
+}
+
 func TestUnixReadOnlyVolumeWithGenericTests(t *testing.T) {
 	DoGenericReadOnlyVolumeTests(t, func(t *testing.T) TestableVolume {
 		return NewTestableUnixVolume(t, false, true)
 	})
 }
 
+func TestUnixReadOnlyVolumeWithGenericTestsSerialized(t *testing.T) {
+	DoGenericReadOnlyVolumeTests(t, func(t *testing.T) TestableVolume {
+		return NewTestableUnixVolume(t, true, true)
+	})
+}
+
 func TestGetNotFound(t *testing.T) {
 	v := NewTestableUnixVolume(t, false, false)
 	defer v.Teardown()
@@ -281,3 +293,15 @@ func TestUnixVolumeCompare(t *testing.T) {
 		t.Errorf("Got err %q, expected %q", err, "permission denied")
 	}
 }
+
+// TODO(twp): show that the underlying Read/Write operations executed
+// serially and not concurrently. The easiest way to do this is
+// probably to activate verbose or debug logging, capture log output
+// and examine it to confirm that Reads and Writes did not overlap.
+//
+// TODO(twp): a proper test of I/O serialization requires that a
+// second request start while the first one is still underway.
+// Guaranteeing that the test behaves this way requires some tricky
+// synchronization and mocking.  For now we'll just launch a bunch of
+// requests simultaenously in goroutines and demonstrate that they
+// return accurate results.

commit 8781021a9ab265b225f0f1eaef6170abde9ce3c3
Merge: 8550361 143a5f3
Author: radhika <radhika at curoverse.com>
Date:   Fri Sep 11 16:46:07 2015 -0400

    Merge branch '7179-generic-volume-tests' of git.curoverse.com:arvados into 7179-generic-volume-tests


commit 8550361e090670395e9f079e7718974b17fc0f5d
Merge: 241f0bc d805ea5
Author: radhika <radhika at curoverse.com>
Date:   Fri Sep 11 15:19:21 2015 -0400

    Merge branch 'master' into 7179-generic-volume-tests


-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list