[ARVADOS] updated: ede1e36731d834142200a99501f9ca948c6a3b36

git at public.curoverse.com git at public.curoverse.com
Tue Mar 10 09:42:25 EDT 2015


Summary of changes:
 services/keepstore/pull_worker_integration_test.go | 50 ++++++++++++++--------
 services/keepstore/pull_worker_test.go             |  1 -
 2 files changed, 32 insertions(+), 19 deletions(-)

       via  ede1e36731d834142200a99501f9ca948c6a3b36 (commit)
      from  edc5c5d88db4f9584db8b8a4ec24e9307ec45244 (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 ede1e36731d834142200a99501f9ca948c6a3b36
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Tue Mar 10 09:42:03 2015 -0400

    3761: Working!!!!

diff --git a/services/keepstore/pull_worker_integration_test.go b/services/keepstore/pull_worker_integration_test.go
index 4944380..2c307e4 100644
--- a/services/keepstore/pull_worker_integration_test.go
+++ b/services/keepstore/pull_worker_integration_test.go
@@ -39,7 +39,12 @@ func SetupPullWorkerIntegrationTest(t *testing.T, testData PullWorkIntegrationTe
 
 	// Put content if the test needs it
 	if wantData {
-		CreateKeepClient(arv, random_token)
+		keepClient = keepclient.KeepClient{
+			Arvados:       &arv,
+			Want_replicas: 1,
+			Using_proxy:   true,
+			Client:        &http.Client{},
+		}
 		keepClient.Arvados.ApiToken = random_token
 
 		service_roots := make(map[string]string)
@@ -52,29 +57,25 @@ func SetupPullWorkerIntegrationTest(t *testing.T, testData PullWorkIntegrationTe
 		if err != nil {
 			t.Errorf("Error putting test data in setup for %s %s %v", testData.Content, locator, err)
 		}
+		if locator == "" {
+			t.Errorf("No locator found after putting test data")
+		}
 	}
 
 	// Create pullRequest for the test
-	CreateKeepClient(arv, random_token)
-
-	pullRequest := PullRequest{
-		Locator: testData.Locator,
-		Servers: servers,
-	}
-	return pullRequest
-}
-
-func CreateKeepClient(arv arvadosclient.ArvadosClient, random_token string) {
-	client := &http.Client{Transport: &http.Transport{
-		TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}}
-
 	keepClient = keepclient.KeepClient{
 		Arvados:       &arv,
 		Want_replicas: 1,
 		Using_proxy:   true,
-		Client:        client,
+		Client:        &http.Client{},
 	}
 	keepClient.Arvados.ApiToken = random_token
+
+	pullRequest := PullRequest{
+		Locator: testData.Locator,
+		Servers: servers,
+	}
+	return pullRequest
 }
 
 func GetKeepServices(t *testing.T) []string {
@@ -129,12 +130,14 @@ func GetKeepServices(t *testing.T) []string {
 	}
 
 	for i, port := range service_ports {
-		servers = append(servers, "https://"+service_names[i]+":"+port)
+		servers = append(servers, "http://"+service_names[i]+":"+port)
 	}
 
 	return servers
 }
 
+// Do a get on a block that is not existing in any of the keep servers.
+// Expect "block not found" error.
 func TestPullWorkerIntegration_GetNonExistingLocator(t *testing.T) {
 	testData := PullWorkIntegrationTestData{
 		Name:     "TestPullWorkerIntegration_GetLocator",
@@ -148,6 +151,8 @@ func TestPullWorkerIntegration_GetNonExistingLocator(t *testing.T) {
 	performPullWorkerIntegrationTest(testData, pullRequest, t)
 }
 
+// Do a get on a block that exists on one of the keep servers.
+// The setup method will create this block before doing the get.
 func TestPullWorkerIntegration_GetExistingLocator(t *testing.T) {
 	testData := PullWorkIntegrationTestData{
 		Name:     "TestPullWorkerIntegration_GetLocator",
@@ -161,9 +166,16 @@ func TestPullWorkerIntegration_GetExistingLocator(t *testing.T) {
 	performPullWorkerIntegrationTest(testData, pullRequest, t)
 }
 
+// Perform the test.
+// The test directly invokes the "PullItemAndProcess" rather than
+// putting an item on the pullq so that the errors can be verified.
 func performPullWorkerIntegrationTest(testData PullWorkIntegrationTestData, pullRequest PullRequest, t *testing.T) {
+
 	// Override PutContent to mock PutBlock functionality
 	PutContent = func(content []byte, locator string) (err error) {
+		if string(content) != testData.Content {
+			t.Errorf("PutContent invoked with unexpected data. Expected: %s; Found: %s", testData.Content, content)
+		}
 		return
 	}
 
@@ -171,9 +183,11 @@ func performPullWorkerIntegrationTest(testData PullWorkIntegrationTestData, pull
 
 	if len(testData.GetError) > 0 {
 		if (err == nil) || (!strings.Contains(err.Error(), testData.GetError)) {
-			t.Fail()
+			t.Errorf("Got error %v", err)
 		}
 	} else {
-		t.Fail()
+		if err != nil {
+			t.Errorf("Got error %v", err)
+		}
 	}
 }
diff --git a/services/keepstore/pull_worker_test.go b/services/keepstore/pull_worker_test.go
index 820f951..dc6d462 100644
--- a/services/keepstore/pull_worker_test.go
+++ b/services/keepstore/pull_worker_test.go
@@ -286,7 +286,6 @@ func performTest(testData PullWorkerTestData, c *C) {
 			c.Assert(string(putContent), Equals, testData.read_content)
 		}
 	}
-
 }
 
 type ClosingBuffer struct {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list