projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
10117: Check that inode is in entries before trying to remove it, along with
[arvados.git]
/
services
/
keepstore
/
trash_worker_test.go
diff --git
a/services/keepstore/trash_worker_test.go
b/services/keepstore/trash_worker_test.go
index 1d3063a9de10651cf675062a439403372d39f49f..94798d95acfd85216ad60982b71282d84530ef7d 100644
(file)
--- a/
services/keepstore/trash_worker_test.go
+++ b/
services/keepstore/trash_worker_test.go
@@
-163,7
+163,7
@@
func TestTrashWorkerIntegration_TwoDifferentLocatorsInVolume1(t *testing.T) {
}
/* Allow default Trash Life time to be used. Thus, the newly created block
}
/* Allow default Trash Life time to be used. Thus, the newly created block
- will not be deleted bec
ua
se its Mtime is within the trash life time.
+ will not be deleted bec
au
se its Mtime is within the trash life time.
*/
func TestTrashWorkerIntegration_SameLocatorInTwoVolumesWithDefaultTrashLifeTime(t *testing.T) {
neverDelete = false
*/
func TestTrashWorkerIntegration_SameLocatorInTwoVolumesWithDefaultTrashLifeTime(t *testing.T) {
neverDelete = false
@@
-236,7
+236,7
@@
func performTrashWorkerTest(testData TrashWorkerTestData, t *testing.T) {
// Create TrashRequest for the test
trashRequest := TrashRequest{
Locator: testData.DeleteLocator,
// Create TrashRequest for the test
trashRequest := TrashRequest{
Locator: testData.DeleteLocator,
- BlockMtime: oldBlockTime.Unix(),
+ BlockMtime: oldBlockTime.Unix
Nano
(),
}
// Run trash worker and put the trashRequest on trashq
}
// 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
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 testData.ExpectLocator1 {
- if
len(data) == 0
{
+ if
size == 0 || err != nil
{
t.Errorf("Expected Locator1 to be still present: %s", testData.Locator1)
}
} else {
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 {
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 testData.ExpectLocator2 {
- if
len(data) == 0
{
+ if
size == 0 || err != nil
{
t.Errorf("Expected Locator2 to be still present: %s", testData.Locator2)
}
} else {
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)
}
}
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 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
}
}
locatorFoundIn = locatorFoundIn + 1
}
}