From 74544f439360e3ece1d7609d76eb47bb4cf41faf Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Tue, 16 May 2017 13:03:14 -0400 Subject: [PATCH] 11644: Test non-empty MountUUID in trash list. --- services/keepstore/trash_worker_test.go | 29 ++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/keepstore/trash_worker_test.go b/services/keepstore/trash_worker_test.go index 04b034a979..61989cb359 100644 --- a/services/keepstore/trash_worker_test.go +++ b/services/keepstore/trash_worker_test.go @@ -22,7 +22,8 @@ type TrashWorkerTestData struct { UseTrashLifeTime bool DifferentMtimes bool - DeleteLocator string + DeleteLocator string + SpecifyMountUUID bool ExpectLocator1 bool ExpectLocator2 bool @@ -139,6 +140,29 @@ func TestTrashWorkerIntegration_MtimeMatchesForLocator1ButNotForLocator2(t *test performTrashWorkerTest(testData, t) } +// Delete a block that exists on both volumes with matching mtimes, +// but specify a MountUUID in the request so it only gets deleted from +// the first volume. +func TestTrashWorkerIntegration_SpecifyMountUUID(t *testing.T) { + theConfig.EnableDelete = true + testData := TrashWorkerTestData{ + Locator1: TestHash, + Block1: TestBlock, + + Locator2: TestHash, + Block2: TestBlock, + + CreateData: true, + + DeleteLocator: TestHash, + SpecifyMountUUID: true, + + ExpectLocator1: true, + ExpectLocator2: true, + } + performTrashWorkerTest(testData, t) +} + /* Two different locators in volume 1. Delete one of them. Expect the other unaffected. @@ -239,6 +263,9 @@ func performTrashWorkerTest(testData TrashWorkerTestData, t *testing.T) { Locator: testData.DeleteLocator, BlockMtime: oldBlockTime.UnixNano(), } + if testData.SpecifyMountUUID { + trashRequest.MountUUID = KeepVM.Mounts()[0].UUID + } // Run trash worker and put the trashRequest on trashq trashList := list.New() -- 2.30.2