X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6fb784416db6651b33b921a0684c2f8de84410fc..5bbf25e6e165455a9edc639fa4096e2aa7b35703:/services/keepstore/trash_worker_test.go diff --git a/services/keepstore/trash_worker_test.go b/services/keepstore/trash_worker_test.go index 04b034a979..c5a410b06f 100644 --- a/services/keepstore/trash_worker_test.go +++ b/services/keepstore/trash_worker_test.go @@ -1,3 +1,7 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + package main import ( @@ -22,7 +26,8 @@ type TrashWorkerTestData struct { UseTrashLifeTime bool DifferentMtimes bool - DeleteLocator string + DeleteLocator string + SpecifyMountUUID bool ExpectLocator1 bool ExpectLocator2 bool @@ -139,6 +144,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 +267,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()