Merge branch 'master' into 3187-pipeline-instance-page
[arvados.git] / services / keepstore / handler_test.go
index 9d6031213e1224e2e87fcba93af1c65c5251b3c1..deb1c3dd110d146d50efa1e7bd5fc3e8711c5281 100644 (file)
@@ -586,12 +586,12 @@ func TestDeleteHandler(t *testing.T) {
 //   4. Invalid pull request from the data manager
 //      (expected result: 400 Bad Request)
 //
-// Test that in the end, the replicator received a good pull list with
+// Test that in the end, the pull manager received a good pull list with
 // the expected number of requests.
 //
 // TODO(twp): test concurrency: launch 100 goroutines to update the
 // pull list simultaneously.  Make sure that none of them return 400
-// Bad Request and that replica.GetList() returns a valid list.
+// Bad Request and that pullmgr.GetList() returns a valid list.
 //
 func TestPullHandler(t *testing.T) {
        defer teardown()
@@ -661,13 +661,16 @@ func TestPullHandler(t *testing.T) {
                ExpectBody(t, tst.name, tst.response_body, response)
        }
 
-       // The Keep replicator should have received one good list with 3
+       // The Keep pull manager should have received one good list with 3
        // requests on it.
-       var saved_pull_list = replica.GetList()
-       if len(saved_pull_list) != 3 {
-               t.Errorf(
-                       "saved_pull_list: expected 3 elements, got %d\nsaved_pull_list = %v",
-                       len(saved_pull_list), saved_pull_list)
+       var output_list = make([]PullRequest, 3)
+       for i := 0; i < 3; i++ {
+               item := <-pullmgr.NextItem
+               if pr, ok := item.(PullRequest); ok {
+                       output_list[i] = pr
+               } else {
+                       t.Errorf("item %v could not be parsed as a PullRequest", item)
+               }
        }
 }