From 8b24d312ec4538b65bf908d8c904f031bd7208dd Mon Sep 17 00:00:00 2001 From: Herve Eruam Date: Mon, 6 Jan 2025 10:48:24 +0100 Subject: [PATCH] Adress PR comment. --- test/libsyncengine/jobs/testjobmanager.cpp | 8 ++++---- test/test_utility/remotetemporarydirectory.cpp | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/libsyncengine/jobs/testjobmanager.cpp b/test/libsyncengine/jobs/testjobmanager.cpp index e27f3750f..6f28c60d1 100644 --- a/test/libsyncengine/jobs/testjobmanager.cpp +++ b/test/libsyncengine/jobs/testjobmanager.cpp @@ -196,11 +196,11 @@ void TestJobManager::testCancelJobs() { cancelAllOngoingJobs(); - int rerty = 1000; // Wait max 10sec + int retry = 1000; // Wait max 10sec while ((!JobManager::_managedJobs.empty() || !JobManager::_queuedJobs.empty() || !JobManager::_runningJobs.empty() || !JobManager::_pendingJobs.empty()) && - (rerty > 0)) { - rerty--; + (retry > 0)) { + retry--; Utility::msleep(10); } @@ -216,7 +216,7 @@ void TestJobManager::testCancelJobs() { CPPUNIT_ASSERT(resObj); Poco::JSON::Array::Ptr data = resObj->getArray(dataKey); - size_t uploadedFileCounter = data->size(); + const size_t uploadedFileCounter = data->size(); CPPUNIT_ASSERT(localFileCounter != uploadedFileCounter); CPPUNIT_ASSERT(uploadedFileCounter > 0); CPPUNIT_ASSERT(ongoingJobsCount() == 0); diff --git a/test/test_utility/remotetemporarydirectory.cpp b/test/test_utility/remotetemporarydirectory.cpp index c08ada9a5..43eea5f07 100644 --- a/test/test_utility/remotetemporarydirectory.cpp +++ b/test/test_utility/remotetemporarydirectory.cpp @@ -29,9 +29,9 @@ namespace KDC { RemoteTemporaryDirectory::RemoteTemporaryDirectory(int driveDbId, const NodeId& parentId, const std::string& testType /*= "undef"*/) : _driveDbId(driveDbId) { - std::string suffix = CommonUtility::generateRandomStringAlphaNum(5); int retry = 5; do { + std::string suffix = CommonUtility::generateRandomStringAlphaNum(5); // Generate directory name const std::time_t now = std::time(nullptr); const std::tm tm = *std::localtime(&now); @@ -43,7 +43,6 @@ RemoteTemporaryDirectory::RemoteTemporaryDirectory(int driveDbId, const NodeId& CreateDirJob job(_driveDbId, parentId, _dirName); job.runSynchronously(); if (job.exitInfo() == ExitInfo(ExitCode::BackError, ExitCause::FileAlreadyExist) && retry > 0) { - suffix = CommonUtility::generateRandomStringAlphaNum(5); retry--; continue; } @@ -56,8 +55,7 @@ RemoteTemporaryDirectory::RemoteTemporaryDirectory(int driveDbId, const NodeId& CPPUNIT_ASSERT(dataObj); _dirId = dataObj->get(idKey).toString(); LOGW_INFO(Log::instance()->getLogger(), L"RemoteTemporaryDirectory created: " << Utility::formatSyncName(_dirName) - << L" with ID: " - << Utility::s2ws(_dirId)); + << L" with ID: " << Utility::s2ws(_dirId)); break; } while (true); }