[ARVADOS] updated: 7a7b8ee61a48c40c45f3c600ca782d81a57f27a1

git at public.curoverse.com git at public.curoverse.com
Thu May 14 16:57:40 EDT 2015


Summary of changes:
 services/keepstore/handler_test.go | 63 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

       via  7a7b8ee61a48c40c45f3c600ca782d81a57f27a1 (commit)
      from  ae34fb3db3c082d529a3e9a75698094409d70321 (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 7a7b8ee61a48c40c45f3c600ca782d81a57f27a1
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu May 14 17:01:13 2015 -0400

    5748: Basic tests to check for bufferpool resource leaks

diff --git a/services/keepstore/handler_test.go b/services/keepstore/handler_test.go
index 6823ad0..7855769 100644
--- a/services/keepstore/handler_test.go
+++ b/services/keepstore/handler_test.go
@@ -803,3 +803,66 @@ func ExpectBody(
 			testname, expected_body, response)
 	}
 }
+
+// Invoke the PutBlockHandler a bunch of times to test for bufferpool resource
+// leak.
+func TestPutHandlerNoBufferleak(t *testing.T) {
+	defer teardown()
+
+	// Prepare two test Keep volumes.
+	KeepVM = MakeTestVolumeManager(2)
+	defer KeepVM.Close()
+
+	// Unfortunately this will just hang if the bug is present, because
+	// bufferPool.Get() blocks forever.  To make this actually fail we need
+	// some kind of watchdog timer that kills the test after a while.
+
+	for i := 0; i < maxBuffers+1; i += 1 {
+		// Unauthenticated request, no server key
+		// => OK (unsigned response)
+		unsigned_locator := "/" + TEST_HASH
+		response := IssueRequest(
+			&RequestTester{
+				method:       "PUT",
+				uri:          unsigned_locator,
+				request_body: TEST_BLOCK,
+			})
+		ExpectStatusCode(t,
+			"TestPutHandlerBufferleak", http.StatusOK, response)
+		ExpectBody(t,
+			"TestPutHandlerBufferleak",
+			TEST_HASH_PUT_RESPONSE, response)
+	}
+}
+
+// Invoke the GetBlockHandler a bunch of times to test for bufferpool resource
+// leak.
+func TestGetHandlerNoBufferleak(t *testing.T) {
+	defer teardown()
+
+	// Prepare two test Keep volumes. Our block is stored on the second volume.
+	KeepVM = MakeTestVolumeManager(2)
+	defer KeepVM.Close()
+
+	vols := KeepVM.AllWritable()
+	if err := vols[0].Put(TEST_HASH, TEST_BLOCK); err != nil {
+		t.Error(err)
+	}
+
+	for i := 0; i < maxBuffers+1; i += 1 {
+		// Unauthenticated request, unsigned locator
+		// => OK
+		unsigned_locator := "/" + TEST_HASH
+		response := IssueRequest(
+			&RequestTester{
+				method: "GET",
+				uri:    unsigned_locator,
+			})
+		ExpectStatusCode(t,
+			"Unauthenticated request, unsigned locator", http.StatusOK, response)
+		ExpectBody(t,
+			"Unauthenticated request, unsigned locator",
+			string(TEST_BLOCK),
+			response)
+	}
+}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list