summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-12-05 08:48:26 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-12-05 08:48:32 +0100
commit5bf3fc86be481a1b8b8d7ed54187a4a2a6833b34 (patch)
tree2214e00463f2387a2666e8ef12a1e5676a9ffd4c /test
parent709b81246d7c1339acba3651fe9077ed468a31b4 (diff)
test: fix UnitLoad::testConnectNoLoad()
Depending on timing, this failed with the following error: wsd-14400-14411 [ docbroker_001 ] WRN Will not load document marked to destroy. DocKey: [/tmp/connectNoLoad_27c61e41_hello.odt].| wsd/DocumentBroker.cpp:520 Make sure we don't try to load the same document again when the cleanup for the previous session is not done yet. Change-Id: I354999fa934df665b48dca314d2b77ab95c84ec0
Diffstat (limited to 'test')
-rw-r--r--test/UnitLoad.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/UnitLoad.cpp b/test/UnitLoad.cpp
index bb549b732..2e5ec24ea 100644
--- a/test/UnitLoad.cpp
+++ b/test/UnitLoad.cpp
@@ -17,6 +17,8 @@
#include <Poco/URI.h>
#include <cppunit/TestAssert.h>
+#include <wsd/DocumentBroker.hpp>
+#include <wsd/LOOLWSD.hpp>
#include <Unit.hpp>
#include <helpers.hpp>
@@ -79,6 +81,14 @@ UnitBase::TestResult UnitLoad::testConnectNoLoad()
TST_LOG_NAME(testname1, "Disconnecting first.");
socket.reset();
+ std::vector<std::shared_ptr<DocumentBroker>> brokers = LOOLWSD::getBrokersTestOnly();
+ if (!brokers.empty() && !brokers[0]->isMarkedToDestroy())
+ {
+ // Give the document broker thread time, so it can clean up, so the next load won't fail
+ // (sometimes), because a cleanup is in progress.
+ sleep(1);
+ }
+
// Connect and load first view.
TST_LOG_NAME(testname2, "Connecting second to load first view.");
std::shared_ptr<LOOLWebSocket> socket1