Skip to content

Commit

Permalink
wsd: test: more stable UnitQuarantine
Browse files Browse the repository at this point in the history
Change-Id: I5f6c18afef36a2fadd6d618a7864bf01d72cf8ad
Signed-off-by: Ashod Nakashian <[email protected]>
  • Loading branch information
Ashod authored and caolanm committed Nov 21, 2024
1 parent 051c99d commit cea23f5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/UnitQuarantine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#include <csignal>
#include <ctime>

/// Since our fake URL is always the same, this is the document path in the quarantine directory.
constexpr auto DocumentUrl = "/http%3A%2F%2F127.0.0.1%3A9981%2Fwopi%2Ffiles%2F0/";

namespace
{
std::vector<std::string> getQuarantineFiles(const std::string testname,
Expand Down Expand Up @@ -238,7 +235,8 @@ class UnitQuarantineConflict : public WOPIUploadConflictCommon
LOK_ASSERT_EQUAL_MESSAGE("Unexpected contents in storage", std::string(OriginalDocContent),
getFileContent());

const std::string quarantinePath = _quarantinePath + DocumentUrl;
const std::string documentUrl = Uri::encode(helpers::getTestServerURI() + "/wopi/files/0");
const std::string quarantinePath = _quarantinePath + '/' + documentUrl;
const std::vector<std::string> files = getQuarantineFiles(testname, quarantinePath);
LOK_ASSERT_MESSAGE("Expected 1 quaratined files in [" << quarantinePath << ']',
files.size() == 1);
Expand Down Expand Up @@ -342,7 +340,7 @@ class UnitQuarantineCrash : public WopiTestServer
void kitKilled(int count) override
{
LOG_TST("Kit killed");
LOK_ASSERT_EQUAL_MESSAGE("Expected only 1 killed kit", 1, count);
LOK_ASSERT(static_cast<std::size_t>(count) <= _kitsPids.size());

// This supresses the default handler which fails the test.
}
Expand All @@ -367,7 +365,8 @@ class UnitQuarantineCrash : public WopiTestServer
LOG_TST("Testing with dockey [" << docKey << "] closed.");
LOK_ASSERT_STATE(_phase, Phase::Unload);

const std::string quarantinePath = _quarantinePath + DocumentUrl;
const std::string documentUrl = Uri::encode(helpers::getTestServerURI() + "/wopi/files/0");
const std::string quarantinePath = _quarantinePath + '/' + documentUrl;
const std::vector<std::string> files = getQuarantineFiles(testname, quarantinePath);
LOK_ASSERT_MESSAGE("Expected 1 quaratined files in [" << quarantinePath << ']',
files.size() == 1);
Expand Down

0 comments on commit cea23f5

Please sign in to comment.