Skip to content

Commit

Permalink
Re #7215. Change testing strategy to avoid occasional failures.
Browse files Browse the repository at this point in the history
I think the sporadic failures of this test were because alg2 had not
started up even after the sleep. Calling validateInputs() instead
accomplishes the same testing goal and avoid having to execute this
instance of the algorithm at all.
  • Loading branch information
RussellTaylor committed Jun 3, 2013
1 parent f0ea430 commit 489709a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Code/Mantid/Framework/DataHandling/test/MonitorLiveDataTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ class MonitorLiveDataTest : public CxxTest::TestSuite


/** Create but don't start a MonitorLiveData thread */
IAlgorithm_sptr makeAlgo(std::string output, std::string accumWS="",
boost::shared_ptr<MonitorLiveData> makeAlgo(std::string output, std::string accumWS="",
std::string AccumulationMethod="Replace",
std::string EndRunBehavior="Restart", std::string UpdateEvery="1")
{
IAlgorithm_sptr alg = AlgorithmManager::Instance().create("MonitorLiveData", -1, false);
auto alg = boost::dynamic_pointer_cast<MonitorLiveData>(AlgorithmManager::Instance().create("MonitorLiveData", -1, false));
alg->setPropertyValue("Instrument", "TestDataListener");
alg->setPropertyValue("UpdateEvery", UpdateEvery);
alg->setPropertyValue("AccumulationMethod", AccumulationMethod);
Expand Down Expand Up @@ -122,11 +122,7 @@ class MonitorLiveDataTest : public CxxTest::TestSuite

// This algorithm if OK because the other is not still running
IAlgorithm_sptr alg2 = makeAlgo("fake1");
Poco::ActiveResult<bool> res2 = alg2->executeAsync();
Poco::Thread::sleep(100); // give it some time to start
TS_ASSERT( alg2->isRunning() );
alg2->cancel();
res2.wait(10000);
TSM_ASSERT("validateInputs should give the all clear (an empty map)", alg2->validateInputs().empty() );
}


Expand Down

0 comments on commit 489709a

Please sign in to comment.