X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/4de0af809ffbef43d89cd1751e5d611a4b5445e9..143a5f355100b837daa428231df0370b525a1f9f:/services/keepstore/pull_worker_test.go?ds=inline diff --git a/services/keepstore/pull_worker_test.go b/services/keepstore/pull_worker_test.go index 822d202bd0..37d83b3280 100644 --- a/services/keepstore/pull_worker_test.go +++ b/services/keepstore/pull_worker_test.go @@ -236,6 +236,9 @@ func (s *PullWorkerTestSuite) TestPullWorker_invalid_data_manager_token(c *C) { } func performTest(testData PullWorkerTestData, c *C) { + KeepVM = MakeTestVolumeManager(2) + defer KeepVM.Close() + RunTestPullWorker(c) defer pullq.Close() @@ -245,10 +248,11 @@ func performTest(testData PullWorkerTestData, c *C) { processedPullLists := make(map[string]string) // Override GetContent to mock keepclient Get functionality - defer func(orig func(string, *keepclient.KeepClient)(io.ReadCloser, int64, string, error)) { + defer func(orig func(string, *keepclient.KeepClient) (io.ReadCloser, int64, string, error)) { GetContent = orig }(GetContent) GetContent = func(signedLocator string, keepClient *keepclient.KeepClient) (reader io.ReadCloser, contentLength int64, url string, err error) { + c.Assert(getStatusItem("PullQueue", "InProgress"), Equals, float64(1)) processedPullLists[testData.name] = testData.response_body if testData.read_error { err = errors.New("Error getting data") @@ -264,7 +268,7 @@ func performTest(testData PullWorkerTestData, c *C) { } // Override PutContent to mock PutBlock functionality - defer func(orig func([]byte, string)(error)) { PutContent = orig }(PutContent) + defer func(orig func([]byte, string) error) { PutContent = orig }(PutContent) PutContent = func(content []byte, locator string) (err error) { if testData.put_error { err = errors.New("Error putting data") @@ -276,11 +280,17 @@ func performTest(testData PullWorkerTestData, c *C) { } } + c.Assert(getStatusItem("PullQueue", "InProgress"), Equals, float64(0)) + c.Assert(getStatusItem("PullQueue", "Queued"), Equals, float64(0)) + response := IssueRequest(&testData.req) c.Assert(response.Code, Equals, testData.response_code) c.Assert(response.Body.String(), Equals, testData.response_body) - expectEqualWithin(c, time.Second, 0, func() interface{} { return pullq.CountOutstanding() }) + expectEqualWithin(c, time.Second, 0, func() interface{} { + st := pullq.Status() + return st.InProgress + st.Queued + }) if testData.name == "TestPullWorker_pull_list_with_two_items_latest_replacing_old" { c.Assert(len(testPullLists), Equals, 2)