X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/628f2f2e1bfabdb7221badab3d5189011aee5a54..46df7c2b292e5f12da365b918b0f28757eb4c4ce:/services/keepstore/trash_worker_test.go diff --git a/services/keepstore/trash_worker_test.go b/services/keepstore/trash_worker_test.go index ac9406178c..94798d95ac 100644 --- a/services/keepstore/trash_worker_test.go +++ b/services/keepstore/trash_worker_test.go @@ -236,7 +236,7 @@ func performTrashWorkerTest(testData TrashWorkerTestData, t *testing.T) { // Create TrashRequest for the test trashRequest := TrashRequest{ Locator: testData.DeleteLocator, - BlockMtime: oldBlockTime.Unix(), + BlockMtime: oldBlockTime.UnixNano(), } // Run trash worker and put the trashRequest on trashq @@ -290,26 +290,27 @@ func performTrashWorkerTest(testData TrashWorkerTestData, t *testing.T) { expectEqualWithin(t, time.Second, 0, func() interface{} { return trashq.Status().InProgress }) // Verify Locator1 to be un/deleted as expected - data, _ := GetBlock(testData.Locator1) + buf := make([]byte, BlockSize) + size, err := GetBlock(testData.Locator1, buf, nil) if testData.ExpectLocator1 { - if len(data) == 0 { + if size == 0 || err != nil { t.Errorf("Expected Locator1 to be still present: %s", testData.Locator1) } } else { - if len(data) > 0 { + if size > 0 || err == nil { t.Errorf("Expected Locator1 to be deleted: %s", testData.Locator1) } } // Verify Locator2 to be un/deleted as expected if testData.Locator1 != testData.Locator2 { - data, _ = GetBlock(testData.Locator2) + size, err = GetBlock(testData.Locator2, buf, nil) if testData.ExpectLocator2 { - if len(data) == 0 { + if size == 0 || err != nil { t.Errorf("Expected Locator2 to be still present: %s", testData.Locator2) } } else { - if len(data) > 0 { + if size > 0 || err == nil { t.Errorf("Expected Locator2 to be deleted: %s", testData.Locator2) } } @@ -321,7 +322,8 @@ func performTrashWorkerTest(testData TrashWorkerTestData, t *testing.T) { if testData.DifferentMtimes { locatorFoundIn := 0 for _, volume := range KeepVM.AllReadable() { - if _, err := volume.Get(testData.Locator1); err == nil { + buf := make([]byte, BlockSize) + if _, err := volume.Get(testData.Locator1, buf); err == nil { locatorFoundIn = locatorFoundIn + 1 } }