+
+ // create another collection, whose blocks will be backdated and the collection will be deleted
+ toBeDeletedCollection, toBeDeletedCollectionBlocks := createMultiStreamBlockCollection(t, "new block", 2, 5)
+ if toBeDeletedCollection == "" {
+ t.Fatalf("Failed to create collection with 10 blocks")
+ }
+
+ // create a stray block that will be backdated
+ strayOldBlock := putBlock(t, "this stray block is old")
+
+ // create another block that will not be backdated
+ strayNewBlock := putBlock(t, "this stray block is new")
+
+ expected := []string{}
+ expected = append(expected, oldBlocks...)
+ expected = append(expected, toBeDeletedCollectionBlocks...)
+ expected = append(expected, strayOldBlock)
+ expected = append(expected, strayNewBlock)
+ verifyBlocks(t, nil, expected, 2)
+
+ // Backdate old blocks; but the collection still references these blocks
+ backdateBlocks(t, oldBlocks)
+
+ // Backdate first block from the newer blocks and delete the collection; the rest are still be reachable
+ backdateBlocks(t, toBeDeletedCollectionBlocks)
+ deleteCollection(t, toBeDeletedCollection)
+
+ // also backdate the stray old block
+ backdateBlocks(t, []string{strayOldBlock})
+
+ // run datamanager
+ dataManagerSingleRun(t)
+
+ expected = []string{strayNewBlock}
+ expected = append(expected, oldBlocks...)
+
+ notExpected := []string{strayOldBlock}
+ notExpected = append(notExpected, toBeDeletedCollectionBlocks...)
+
+ verifyBlocks(t, notExpected, expected, 2)