OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Port https://github.com/opf/openproject/pull/14963 to dev.
Pavel Balashou118b54f96f23
diff --git a/modules/storages/app/workers/storages/manage_nextcloud_integration_job.rb b/modules/storages/app/workers/storages/manage_nextcloud_integration_job.rbindex dae51a8433f..fe38ffaea2c 100644--- a/modules/storages/app/workers/storages/manage_nextcloud_integration_job.rb+++ b/modules/storages/app/workers/storages/manage_nextcloud_integration_job.rb@@ -81,6 +81,7 @@ module Storagesdef performfind_storages do |storage|+ next unless storage.configured?result = service_for(storage).call(storage)result.match(on_success: ->(_) { storage.mark_as_healthy },diff --git a/modules/storages/spec/workers/storages/manage_nextcloud_integration_job_spec.rb b/modules/storages/spec/workers/storages/manage_nextcloud_integration_job_spec.rbindex 4e47dbb821d..30428058348 100644--- a/modules/storages/spec/workers/storages/manage_nextcloud_integration_job_spec.rb+++ b/modules/storages/spec/workers/storages/manage_nextcloud_integration_job_spec.rb@@ -106,26 +106,27 @@ RSpec.describe Storages::ManageNextcloudIntegrationJob, :webmock, type: :job doenddescribe '.perform' do+ let(:storage1) { create(:nextcloud_storage_configured, :as_automatically_managed) }+subject { described_class.new.perform }it 'calls NextcloudGroupFolderPropertiesSyncService for each automatically managed storage' do- storage1 = create(:nextcloud_storage, :as_automatically_managed)storage2 = create(:nextcloud_storage, :as_not_automatically_managed)+ storage3 = create(:nextcloud_storage, :as_automatically_managed)allow(Storages::NextcloudGroupFolderPropertiesSyncService)- .to receive(:call).with(storage1).and_return(ServiceResult.success)+ .to receive(:call).with(storage1).and_return(ServiceResult.success)subjectexpect(Storages::NextcloudGroupFolderPropertiesSyncService).to have_received(:call).with(storage1).onceexpect(Storages::NextcloudGroupFolderPropertiesSyncService).not_to have_received(:call).with(storage2)+ expect(Storages::NextcloudGroupFolderPropertiesSyncService).not_to have_received(:call).with(storage3)endit 'marks storage as healthy if sync was successful' do- storage1 = create(:nextcloud_storage, :as_automatically_managed)-allow(Storages::NextcloudGroupFolderPropertiesSyncService)- .to receive(:call).with(storage1).and_return(ServiceResult.success)+ .to receive(:call).with(storage1).and_return(ServiceResult.success)Timecop.freeze('2023-03-14T15:17:00Z') doexpect do@@ -139,10 +140,10 @@ RSpec.describe Storages::ManageNextcloudIntegrationJob, :webmock, type: :job doendit 'marks storage as unhealthy if sync was unsuccessful' do- storage1 = create(:nextcloud_storage, :as_automatically_managed)-allow(Storages::NextcloudGroupFolderPropertiesSyncService)- .to receive(:call).with(storage1).and_return(ServiceResult.failure(errors: Storages::StorageError.new(code: :not_found)))+ .to receive(:call)+ .with(storage1)+ .and_return(ServiceResult.failure(errors: Storages::StorageError.new(code: :not_found)))Timecop.freeze('2023-03-14T15:17:00Z') doexpect do