client-test: speed up interrupt tests
The testInterrupt* tests simulate a hard transport failure. Each time that happened, SyncContext would retry at least once after the default retry period (1 minute) before giving up, slowing down the testing considerably. With the new SyncOptions "retryInterval" set to zero, retrying is disabled. This must not be done when testing the resending itself.
This commit is contained in:
parent
c2cc198514
commit
62921bd1c9
|
@ -332,6 +332,8 @@ public:
|
|||
setMaxObjSize(m_options.m_maxObjSize, true);
|
||||
setMaxMsgSize(m_options.m_maxMsgSize, true);
|
||||
setWBXML(m_options.m_isWBXML, true);
|
||||
setRetryDuration(m_options.m_retryDuration, true);
|
||||
setRetryInterval(m_options.m_retryInterval, true);
|
||||
SyncContext::prepare();
|
||||
}
|
||||
|
||||
|
|
|
@ -2922,12 +2922,17 @@ void SyncTests::doInterruptResume(int changes,
|
|||
// by overloading the delete operator.
|
||||
int wasInterrupted;
|
||||
{
|
||||
SyncOptions options(SYNC_TWO_WAY,
|
||||
CheckSyncReport(-1, -1, -1, -1,
|
||||
-1, -1, resend));
|
||||
options.setTransportAgent(wrapper);
|
||||
options.setMaxMsgSize(maxMsgSize);
|
||||
if (!resend) {
|
||||
// disable resending completely
|
||||
options.setRetryInterval(0);
|
||||
}
|
||||
wrapper->setInterruptAtMessage(interruptAtMessage);
|
||||
accessClientB->doSync("changesFromB",
|
||||
SyncOptions(SYNC_TWO_WAY,
|
||||
CheckSyncReport(-1, -1, -1, -1,
|
||||
-1, -1, resend)).setTransportAgent(wrapper)
|
||||
.setMaxMsgSize(maxMsgSize));
|
||||
accessClientB->doSync("changesFromB", options);
|
||||
wasInterrupted = interruptAtMessage != -1 &&
|
||||
wrapper->getMessageCount() <= interruptAtMessage;
|
||||
wrapper->rewind();
|
||||
|
|
|
@ -115,6 +115,9 @@ struct SyncOptions {
|
|||
bool m_loSupport;
|
||||
/** enabled WBXML (default) */
|
||||
bool m_isWBXML;
|
||||
/** overrides resend properties */
|
||||
int m_retryDuration;
|
||||
int m_retryInterval;
|
||||
|
||||
bool m_isSuspended;
|
||||
|
||||
|
@ -146,6 +149,8 @@ struct SyncOptions {
|
|||
m_maxObjSize(maxObjSize),
|
||||
m_loSupport(loSupport),
|
||||
m_isWBXML(isWBXML),
|
||||
m_retryDuration(300),
|
||||
m_retryInterval(60),
|
||||
m_isSuspended(false),
|
||||
m_isAborted(false),
|
||||
m_startCallback(startCallback),
|
||||
|
@ -158,6 +163,8 @@ struct SyncOptions {
|
|||
SyncOptions &setMaxObjSize(long maxObjSize) { m_maxObjSize = maxObjSize; return *this; }
|
||||
SyncOptions &setLOSupport(bool loSupport) { m_loSupport = loSupport; return *this; }
|
||||
SyncOptions &setWBXML(bool isWBXML) { m_isWBXML = isWBXML; return *this; }
|
||||
SyncOptions &setRetryDuration(int retryDuration) { m_retryDuration = retryDuration; return *this; }
|
||||
SyncOptions &setRetryInterval(int retryInterval) { m_retryInterval = retryInterval; return *this; }
|
||||
SyncOptions &setStartCallback(const Callback_t &callback) { m_startCallback = callback; return *this; }
|
||||
SyncOptions &setTransportAgent(const boost::shared_ptr<TransportAgent> transport)
|
||||
{m_transport = transport; return *this;}
|
||||
|
|
Loading…
Reference in New Issue