- locator_data = SalvageCollection.salvage_collection_locator_data manifest
- assert_equal true, locator_data[0].size.eql?(4)
- assert_equal false, locator_data[0].include?("341dabea2bd78ad0d6fc3f5b926b450e+abc")
- assert_equal true, locator_data[0].include?("341dabea2bd78ad0d6fc3f5b926b450e")
- assert_equal true, locator_data[0].include?("341dabea2bd78ad0d6fc3f5b926abcdf")
- assert_equal true, locator_data[0].include?("341dabea2bd78ad0d6fc3f5b926b450e+1000")
- assert_equal true, locator_data[0].include?("d7321a918923627c972d8f8080c07d29+2000")
- assert_equal true, locator_data[1].eql?(1000 + 2000) # size
+ salvage_collection src_collection.uuid, 'test salvage collection - see #6277, #6859'
+
+ # verify the updated src_collection data
+ updated_src_collection = Collection.find_by_uuid src_collection.uuid
+ updated_name = updated_src_collection.name
+ assert_equal true, updated_name.include?(src_collection.name)
+
+ match = updated_name.match /^test collection.*salvaged data at (.*)\)$/
+ assert_not_nil match
+ assert_not_nil match[1]
+ assert_empty updated_src_collection.manifest_text
+
+ # match[1] is the uuid of the new collection created from src_collection's salvaged data
+ # use this to get the new collection and verify
+ new_collection = Collection.find_by_uuid match[1]
+ match = new_collection.name.match /^salvaged from (.*),.*/
+ assert_not_nil match
+ assert_equal src_collection.uuid, match[1]
+ # verify the new collection's manifest includes the bad locators
+ expected_manifest = ". " + Digest::MD5.hexdigest(BAD_MANIFEST) + "+" + BAD_MANIFEST.length.to_s +
+ " 0:" + BAD_MANIFEST.length.to_s + ":invalid_manifest_text.txt\n. faafaafaabd78ad0d6fc3f5b926b450e baabaabaabd78ad0d6fc3f5b926b450e bad12345dae58ad0d6fc3f5b926b450e 341dabea2bd78ad0d6fc3f5b926b450e 341dabea2bd78ad0d6fc3f5b926abcdf abcdabea2bd78ad0d6fc3f5b926b450e+1000 d7321a918923627c972d8f8080c07d29+2000 0:3000:salvaged_data\n"
+ assert_equal expected_manifest, new_collection.manifest_text