Skip to content

Commit

Permalink
Lock store while corrupting it in test/backupstorefix
Browse files Browse the repository at this point in the history
Should hopefully reduce risk of random test failures/race conditions.

(cherry picked from commit 0f31359)
  • Loading branch information
qris committed Jul 5, 2017
1 parent 9f013c8 commit 15a973a
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions test/backupstorefix/testbackupstorefix.cpp
Expand Up @@ -976,12 +976,25 @@ int test(int argc, const char *argv[])

// ------------------------------------------------------------------------------------------------
BOX_INFO(" === Corrupt file and dir");
// File
CorruptObject("Test1/foreomizes/stemptinevidate/algoughtnerge",
33, "34i729834298349283479233472983sdfhasgs");
// Dir
CorruptObject("Test1/cannes/imulatrougge/foreomizes",23,
"dsf32489sdnadf897fd2hjkesdfmnbsdfcsfoisufio2iofe2hdfkjhsf");
{
// Wait for the server to finish housekeeping (if any) and then lock the account
// before damaging it, to avoid a race condition where bbstored runs housekeeping
// after we disconnect, extremely slowly on AppVeyor, and this causes the second
// bbstoreaccounts check command to time out waiting for a lock.
std::auto_ptr<BackupStoreAccountDatabase> apAccounts(
BackupStoreAccountDatabase::Read("testfiles/accounts.txt"));
BackupStoreAccounts acc(*apAccounts);
NamedLock lock;
acc.LockAccount(0x1234567, lock);

// File
CorruptObject("Test1/foreomizes/stemptinevidate/algoughtnerge", 33,
"34i729834298349283479233472983sdfhasgs");
// Dir
CorruptObject("Test1/cannes/imulatrougge/foreomizes", 23,
"dsf32489sdnadf897fd2hjkesdfmnbsdfcsfoisufio2iofe2hdfkjhsf");
}

// Fix it
RUN_CHECK
// Check everything is where it should be
Expand Down

0 comments on commit 15a973a

Please sign in to comment.