// 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()
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)
+ }
}
}