Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove nextcloud integration job #14975

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def debounce_happend_in_current_thread_recently?

def perform
find_storages do |storage|
next unless storage.configured?
result = service_for(storage).call(storage)
result.match(
on_success: ->(_) { storage.mark_as_healthy },
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -106,26 +106,27 @@
end

describe '.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)

subject

expect(Storages::NextcloudGroupFolderPropertiesSyncService).to have_received(:call).with(storage1).once
expect(Storages::NextcloudGroupFolderPropertiesSyncService).not_to have_received(:call).with(storage2)
expect(Storages::NextcloudGroupFolderPropertiesSyncService).not_to have_received(:call).with(storage3)
end

it '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') do
expect do
Expand All @@ -139,10 +140,10 @@
end

it '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') do
expect do
Expand Down
Loading