Skip to content

Commit

Permalink
fix regressions in automated tests for bulk upload
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Nov 27, 2024
1 parent ae363c9 commit 5916750
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/libsync/bulkpropagatorjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ void BulkPropagatorJob::finalize(const QJsonObject &fullReply)
}
if (!singleFile._item->hasErrorStatus()) {
finalizeOneFile(singleFile);
singleFile._item->_status = OCC::SyncFileItem::Success;
}

done(singleFile._item, singleFile._item->_status, {}, ErrorCategory::GenericError);
Expand Down
12 changes: 6 additions & 6 deletions test/syncenginetestutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,12 @@ QVector<FileInfo *> FakePutMultiFileReply::performMultiPart(FileInfo &remoteRoot
auto onePartBody = onePart.mid(headerEndPosition + 4, onePart.size() - headerEndPosition - 6);
auto onePartHeaders = onePartHeaderPart.split(QStringLiteral("\r\n"));
QMap<QString, QString> allHeaders;
for(auto oneHeader : onePartHeaders) {
for(const auto &oneHeader : onePartHeaders) {
auto headerParts = oneHeader.split(QStringLiteral(": "));
allHeaders[headerParts.at(0)] = headerParts.at(1);
allHeaders[headerParts.at(0).toLower()] = headerParts.at(1);
}
const auto fileName = allHeaders[QStringLiteral("X-File-Path")];
const auto modtime = allHeaders[QByteArrayLiteral("X-File-Mtime")].toLongLong();
const auto fileName = allHeaders[QStringLiteral("x-file-path")];
const auto modtime = allHeaders[QByteArrayLiteral("x-file-mtime")].toLongLong();
Q_ASSERT(!fileName.isEmpty());
Q_ASSERT(modtime > 0);
FileInfo *fileInfo = remoteRootFileInfo.find(fileName);
Expand All @@ -568,7 +568,7 @@ QVector<FileInfo *> FakePutMultiFileReply::performMultiPart(FileInfo &remoteRoot
// Assume that the file is filled with the same character
fileInfo = remoteRootFileInfo.create(fileName, onePartBody.size(), onePartBody.at(0).toLatin1());
}
fileInfo->lastModified = OCC::Utility::qDateTimeFromTime_t(request.rawHeader("X-OC-Mtime").toLongLong());
fileInfo->lastModified = OCC::Utility::qDateTimeFromTime_t(request.rawHeader("x-oc-mtime").toLongLong());
remoteRootFileInfo.find(fileName, /*invalidateEtags=*/true);
result.push_back(fileInfo);
}
Expand Down Expand Up @@ -1058,7 +1058,7 @@ QJsonObject FakeQNAM::forEachReplyPart(QIODevice *outgoingData,
auto reply = replyFunction(allHeaders);
if (reply.contains(QStringLiteral("error")) &&
reply.contains(QStringLiteral("etag"))) {
fullReply.insert(allHeaders[QStringLiteral("X-File-Path")], reply);
fullReply.insert(allHeaders[QStringLiteral("x-file-path")], reply);
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/testsyncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ private slots:
if (contentType.startsWith(QStringLiteral("multipart/related; boundary="))) {
auto jsonReplyObject = fakeFolder.forEachReplyPart(outgoingData, contentType, [] (const QMap<QString, QByteArray> &allHeaders) -> QJsonObject {
auto reply = QJsonObject{};
const auto fileName = allHeaders[QStringLiteral("X-File-Path")];
const auto fileName = allHeaders[QStringLiteral("x-file-path")];
if (fileName.endsWith("A/big2") ||
fileName.endsWith("A/big3") ||
fileName.endsWith("A/big4") ||
Expand Down

0 comments on commit 5916750

Please sign in to comment.