client-test: avoid potential test failure in testTwoWaySync due to preventSlowSync

When running testTwoWaySync, there's no guarantee that the previous sync
succeeded. As a result, the sync may turn into a slow sync. That's okay,
the test was meant to allow that. The problem is that preventSlowSync
then turns that into a sync error, which breaks the test. Seen once in
nightly testing and then reproduced manually.

This patch avoids the problem by disabling preventSlowSync temporarily for
each test which may run in two-way (requested sync mode) and is allowed
to end up with different modes (checked sync mode). It could be extended
to other requested sync modes, but that wasn't necessary so far and isn't
done to minimize changes.
This commit is contained in:
Patrick Ohly 2010-12-06 14:47:32 +01:00
parent ca3159ab03
commit 74516c89f9
1 changed files with 12 additions and 0 deletions

View File

@ -347,6 +347,18 @@ public:
setWBXML(m_options.m_isWBXML, true);
setRetryDuration(m_options.m_retryDuration, true);
setRetryInterval(m_options.m_retryInterval, true);
if (m_options.m_syncMode == SYNC_TWO_WAY &&
m_options.m_checkReport.syncMode == SYNC_NONE) {
// For this test, any kind of final sync mode is
// acceptable. Disable slow sync prevention
// temporarily. The check for the requested sync
// mode is perhaps too conservative, but in
// practice the only test where slow sync
// prevention caused a test failure was
// Client::Sync::vcard30::testTwoWaySync after
// some other failed test, so let's be conservative...
setPreventSlowSync(false);
}
SyncContext::prepare();
}