Fix intermittent failure in Subscribe_test:

Fixes: RIPD-1601

Fix intermittent failure in server stream sub/unsub test.
Root cause is LoadManager thread *sometimes* running and causing a
fee change event which got published before our test could
unsubscribe. Fixed by explicitly stopping the LoadManager for this test.
This commit is contained in:
Mike Ellery
2018-02-27 09:59:03 -08:00
committed by seelabs
parent 1507ed66a8
commit 3730d46dad

View File

@@ -16,6 +16,7 @@
//==============================================================================
#include <BeastConfig.h>
#include <ripple/app/main/LoadManager.h>
#include <ripple/app/misc/LoadFeeTrack.h>
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/core/ConfigSections.h>
@@ -53,6 +54,12 @@ public:
BEAST_EXPECT(jv[jss::status] == "success");
}
// here we forcibly stop the load manager because it can (rarely but
// every-so-often) cause fees to raise or lower AFTER we've called the
// first findMsg but BEFORE we unsubscribe, thus causing the final
// findMsg check to fail since there is one unprocessed ws msg created
// by the loadmanager
env.app().getLoadManager().onStop();
{
// Raise fee to cause an update
auto& feeTrack = env.app().getFeeTrack();
@@ -88,7 +95,8 @@ public:
env.app().getOPs().reportFeeChange();
// Check stream update
BEAST_EXPECT(! wsc->getMsg(10ms));
auto jvo = wsc->getMsg(10ms);
BEAST_EXPECTS(!jvo, "getMsg: " + to_string(jvo.get()) );
}
}