Skip to content
Permalink
Browse files

Make sure bogus files/directories in the file store don't cause probl…

…ems during migration.

git-svn-id: https://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk@14941 e27351fd-9f3e-4f54-a53b-843176b1656c
  • Loading branch information...
cyrusdaboo committed Jul 2, 2015
1 parent f2d5142 commit 931fc8d4b7845e7685b7d775d4689d2b845037bc
Showing with 11 additions and 1 deletion.
  1. +2 −1 txdav/common/datastore/file.py
  2. +9 −0 txdav/common/datastore/upgrade/test/test_migrate.py
@@ -276,7 +276,8 @@ def _homesOfType(self, storeType):
continue
txn = self.newTransaction("enumerate home %r" % (uid,))
home = txn.homeWithUID(storeType, uid, False)
yield (txn, home)
if home is not None:
yield (txn, home)


def _eachCalendarHome(self):
@@ -295,6 +295,15 @@ def test_upgradeCalendarHomes(self):
L{UpgradeToDatabaseService.startService} will do the upgrade, then
start its dependent service by adding it to its service hierarchy.
"""

# Create a fake directory in the same place as a home, but with a non-existent uid
fake_dir = self.filesPath.child("calendars").child("__uids__").child("ho").child("me").child("foobar")
fake_dir.makedirs()

# Create a fake file in the same place as a home,with a name that matches the hash uid prefix
fake_file = self.filesPath.child("calendars").child("__uids__").child("ho").child("me").child("home_file")
fake_file.setContent("")

yield self.upgrader.stepWithResult(None)
txn = self.sqlStore.newTransaction()
self.addCleanup(txn.commit)

0 comments on commit 931fc8d

Please sign in to comment.
You can’t perform that action at this time.