[Pkg-owncloud-commits] [owncloud-client] 11/60: TestChunkingNG: Test that resuming does not send past data.
Sandro Knauß
hefee at debian.org
Sat Dec 16 10:38:10 UTC 2017
This is an automated email from the git hooks/post-receive script.
hefee pushed a commit to branch upstream
in repository owncloud-client.
commit 96dede4e84c88ec085e38fb11db289ea607821b5
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Mon Nov 20 14:27:33 2017 +0100
TestChunkingNG: Test that resuming does not send past data.
---
test/testchunkingng.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/test/testchunkingng.cpp b/test/testchunkingng.cpp
index 16c6856..78003b2 100644
--- a/test/testchunkingng.cpp
+++ b/test/testchunkingng.cpp
@@ -66,16 +66,27 @@ private slots:
void testResume () {
-
FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
fakeFolder.syncEngine().account()->setCapabilities({ { "dav", QVariantMap{ {"chunking", "1.0"} } } });
const int size = 300 * 1000 * 1000; // 300 MB
partialUpload(fakeFolder, "A/a0", size);
QCOMPARE(fakeFolder.uploadState().children.count(), 1);
auto chunkingId = fakeFolder.uploadState().children.first().name;
+ const auto &chunkMap = fakeFolder.uploadState().children.first().children;
+ quint64 uploadedSize = std::accumulate(chunkMap.begin(), chunkMap.end(), 0LL, [](quint64 s, const FileInfo &f) { return s + f.size; });
+ QVERIFY(uploadedSize > 50 * 1000 * 1000); // at least 50 MB
// Add a fake file to make sure it gets deleted
fakeFolder.uploadState().children.first().insert("10000", size);
+
+ fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation op, const QNetworkRequest &request) -> QNetworkReply * {
+ if (op == QNetworkAccessManager::PutOperation) {
+ // Test that we properly resuming and are not sending past data again.
+ Q_ASSERT(request.rawHeader("OC-Chunk-Offset").toULongLong() >= uploadedSize);
+ }
+ return nullptr;
+ });
+
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list