Skip to content

Commit b2bd1e4

Browse files
committed
feat(taskprocessing): fix tests
Signed-off-by: Julien Veyssier <[email protected]>
1 parent 3411631 commit b2bd1e4

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

core/Command/TaskProcessing/Cleanup.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ protected function configure() {
3434

3535
protected function execute(InputInterface $input, OutputInterface $output): int {
3636
$maxAgeSeconds = $input->getArgument('maxAgeSeconds') ?? Manager::MAX_TASK_AGE_SECONDS;
37-
$output->writeln('<comment>Cleanup up tasks older than '. $maxAgeSeconds . ' seconds and the related output files</comment>');
37+
$output->writeln('<comment>Cleanup up tasks older than ' . $maxAgeSeconds . ' seconds and the related output files</comment>');
3838
$cleanupResult = $this->taskProcessingManager->cleanupOldTasks($maxAgeSeconds);
3939
foreach ($cleanupResult as $entry) {
4040
if (isset($entry['task_id'], $entry['file_id'], $entry['file_name'])) {
4141
$output->writeln("<info>\t - " . 'Deleted appData/core/TaskProcessing/' . $entry['file_name'] . ' (fileId: ' . $entry['file_id'] . ', taskId: ' . $entry['task_id'] . ')</info>');
4242
} elseif (isset($entry['directory_name'])) {
43-
$output->writeln("<info>\t - " . 'Deleted appData/core/'. $entry['directory_name'] . '/' . $entry['file_name'] . '</info>');
43+
$output->writeln("<info>\t - " . 'Deleted appData/core/' . $entry['directory_name'] . '/' . $entry['file_name'] . '</info>');
4444
} elseif (isset($entry['deleted_task_count'])) {
45-
$output->writeln("<comment>\t - " . 'Deleted '. $entry['deleted_task_count'] . ' tasks from the database</comment>');
45+
$output->writeln("<comment>\t - " . 'Deleted ' . $entry['deleted_task_count'] . ' tasks from the database</comment>');
4646
} elseif (isset($entry['deleted_task_id_list'])) {
4747
foreach ($entry['deleted_task_id_list'] as $taskId) {
48-
$output->writeln("<info>\t - " . 'Deleted task '. $taskId . ' from the database</info>');
48+
$output->writeln("<info>\t - " . 'Deleted task ' . $taskId . ' from the database</info>');
4949
}
5050
}
5151
}

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,7 @@
13461346
'OC\\Core\\Command\\SystemTag\\Delete' => $baseDir . '/core/Command/SystemTag/Delete.php',
13471347
'OC\\Core\\Command\\SystemTag\\Edit' => $baseDir . '/core/Command/SystemTag/Edit.php',
13481348
'OC\\Core\\Command\\SystemTag\\ListCommand' => $baseDir . '/core/Command/SystemTag/ListCommand.php',
1349+
'OC\\Core\\Command\\TaskProcessing\\Cleanup' => $baseDir . '/core/Command/TaskProcessing/Cleanup.php',
13491350
'OC\\Core\\Command\\TaskProcessing\\EnabledCommand' => $baseDir . '/core/Command/TaskProcessing/EnabledCommand.php',
13501351
'OC\\Core\\Command\\TaskProcessing\\GetCommand' => $baseDir . '/core/Command/TaskProcessing/GetCommand.php',
13511352
'OC\\Core\\Command\\TaskProcessing\\ListCommand' => $baseDir . '/core/Command/TaskProcessing/ListCommand.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
13871387
'OC\\Core\\Command\\SystemTag\\Delete' => __DIR__ . '/../../..' . '/core/Command/SystemTag/Delete.php',
13881388
'OC\\Core\\Command\\SystemTag\\Edit' => __DIR__ . '/../../..' . '/core/Command/SystemTag/Edit.php',
13891389
'OC\\Core\\Command\\SystemTag\\ListCommand' => __DIR__ . '/../../..' . '/core/Command/SystemTag/ListCommand.php',
1390+
'OC\\Core\\Command\\TaskProcessing\\Cleanup' => __DIR__ . '/../../..' . '/core/Command/TaskProcessing/Cleanup.php',
13901391
'OC\\Core\\Command\\TaskProcessing\\EnabledCommand' => __DIR__ . '/../../..' . '/core/Command/TaskProcessing/EnabledCommand.php',
13911392
'OC\\Core\\Command\\TaskProcessing\\GetCommand' => __DIR__ . '/../../..' . '/core/Command/TaskProcessing/GetCommand.php',
13921393
'OC\\Core\\Command\\TaskProcessing\\ListCommand' => __DIR__ . '/../../..' . '/core/Command/TaskProcessing/ListCommand.php',

tests/lib/TaskProcessing/TaskProcessingTest.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,25 @@ public function testOldTasksShouldBeCleanedUp(): void {
948948
$timeFactory,
949949
);
950950

951+
$manager = new Manager(
952+
$this->appConfig,
953+
$this->coordinator,
954+
$this->serverContainer,
955+
Server::get(LoggerInterface::class),
956+
$this->taskMapper,
957+
$this->jobList,
958+
$this->eventDispatcher,
959+
Server::get(IAppDataFactory::class),
960+
Server::get(IRootFolder::class),
961+
Server::get(\OC\TextToImage\Manager::class),
962+
$this->userMountCache,
963+
Server::get(IClientService::class),
964+
Server::get(IAppManager::class),
965+
Server::get(IUserManager::class),
966+
Server::get(IUserSession::class),
967+
Server::get(ICacheFactory::class),
968+
);
969+
951970
$this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([
952971
new ServiceRegistration('test', SuccessfulSyncProvider::class)
953972
]);
@@ -972,7 +991,8 @@ public function testOldTasksShouldBeCleanedUp(): void {
972991
// run background job
973992
$bgJob = new RemoveOldTasksBackgroundJob(
974993
$timeFactory,
975-
$this->manager,
994+
// use a locally defined manager to make sure the taskMapper uses the mocked timeFactory
995+
$manager,
976996
);
977997
$bgJob->setArgument([]);
978998
$bgJob->start($this->jobList);

0 commit comments

Comments
 (0)