[Libreoffice-commits] online.git: test/helpers.hpp test/UnitLoadTorture.cpp

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 20 09:48:17 UTC 2020


 test/UnitLoadTorture.cpp |    3 ++-
 test/helpers.hpp         |    6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit a83dd9a1608b1bdb2569937762a88aeaadee831c
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 20 09:16:22 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Mar 20 10:47:59 2020 +0100

    test: increase load timeout in UnitLoadTorture
    
    This test sometimes failed on me just because the load was aborted due
    to the timeout, doubling the limit makes the problem go away.
    
    Change-Id: Ided724d67a513391b86836065d4e627581857a92
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90771
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/test/UnitLoadTorture.cpp b/test/UnitLoadTorture.cpp
index 430658635..739157c0e 100644
--- a/test/UnitLoadTorture.cpp
+++ b/test/UnitLoadTorture.cpp
@@ -64,7 +64,8 @@ int UnitLoadTorture::loadTorture(const std::string& testname, const std::string&
                     Poco::URI(helpers::getTestServerURI()), request, response, testname);
                 helpers::sendTextFrame(socket, "load url=" + documentURL, testname);
 
-                const auto status = helpers::assertResponseString(socket, "status:", testname);
+                // 20s is double of the default.
+                const auto status = helpers::assertResponseString(socket, "status:", testname, 20000);
                 int viewid = -1;
                 LOOLProtocol::getTokenIntegerFromMessage(status, "viewid", viewid);
                 sum_view_ids += viewid;
diff --git a/test/helpers.hpp b/test/helpers.hpp
index 46aef7605..1b831a289 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -311,7 +311,7 @@ std::vector<char> getResponseMessage(LOOLWebSocket& ws, const std::string& prefi
             auto now = std::chrono::steady_clock::now();
             if (now > endTime) // timedout
             {
-                TST_LOG("Timeout.");
+                TST_LOG("Timeout after " << timeoutMs << " ms.");
                 break;
             }
             long waitTimeUs = std::chrono::duration_cast<std::chrono::microseconds>(endTime - now).count();
@@ -378,9 +378,9 @@ std::string getResponseString(T& ws, const std::string& prefix, const std::strin
 }
 
 template <typename T>
-std::string assertResponseString(T& ws, const std::string& prefix, const std::string& testname)
+std::string assertResponseString(T& ws, const std::string& prefix, const std::string& testname, const size_t timeoutMs = 10000)
 {
-    const auto res = getResponseString(ws, prefix, testname);
+    const auto res = getResponseString(ws, prefix, testname, timeoutMs);
     LOK_ASSERT_EQUAL(prefix, res.substr(0, prefix.length()));
     return res;
 }


More information about the Libreoffice-commits mailing list