Skip to content

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

Rename unconfigured to pending.

Pavel Balashoue774158836a5
diff --git a/modules/storages/app/models/storages/storage.rb b/modules/storages/app/models/storages/storage.rb
index f7809c71402..efc53171eaf 100644
--- a/modules/storages/app/models/storages/storage.rb
+++ b/modules/storages/app/models/storages/storage.rb
@@ -74,10 +74,10 @@ module Storages
end
enum health_status: {
- unconfigured: 'unconfigured',
+ pending: 'pending',
healthy: 'healthy',
unhealthy: 'unhealthy'
- }.freeze
+ }.freeze, _prefix: :health
def self.shorten_provider_type(provider_type)
case /Storages::(?'provider_name'.*)Storage/.match(provider_type)
diff --git a/modules/storages/app/workers/storages/manage_nextcloud_integration_job_mixin.rb b/modules/storages/app/workers/storages/manage_nextcloud_integration_job_mixin.rb
index 1c83b77a760..2e590626783 100644
--- a/modules/storages/app/workers/storages/manage_nextcloud_integration_job_mixin.rb
+++ b/modules/storages/app/workers/storages/manage_nextcloud_integration_job_mixin.rb
@@ -43,10 +43,10 @@ module Storages
result = GroupFolderPropertiesSyncService.call(storage)
result.match(
on_success: ->(_) do
- storage.mark_as_healthy unless storage.healthy?
+ storage.mark_as_healthy unless storage.health_healthy?
end,
on_failure: ->(errors) do
- if !storage.unhealthy? || storage.health_reason != errors.to_s
+ if !storage.health_unhealthy? || storage.health_reason != errors.to_s
storage.mark_as_unhealthy(reason: errors.to_s)
end
end
diff --git a/modules/storages/db/migrate/20231109080454_add_health_info_to_storages.rb b/modules/storages/db/migrate/20231109080454_add_health_info_to_storages.rb
index b35ac45f195..c480c7ff196 100644
--- a/modules/storages/db/migrate/20231109080454_add_health_info_to_storages.rb
+++ b/modules/storages/db/migrate/20231109080454_add_health_info_to_storages.rb
@@ -28,9 +28,9 @@
class AddHealthInfoToStorages < ActiveRecord::Migration[7.0]
def up
execute <<-SQL.squish
- CREATE TYPE storage_health_statuses AS ENUM ('unconfigured', 'healthy', 'unhealthy');
+ CREATE TYPE storage_health_statuses AS ENUM ('pending', 'healthy', 'unhealthy');
SQL
- add_column(:storages, :health_status, :storage_health_statuses, null: false, default: 'unconfigured')
+ add_column(:storages, :health_status, :storage_health_statuses, null: false, default: 'pending')
add_column(:storages, :health_changed_at, :datetime, null: false, default: -> { 'current_timestamp' })
add_column(:storages, :health_reason, :string)
end
diff --git a/modules/storages/spec/models/storages/nextcloud_storage_spec.rb b/modules/storages/spec/models/storages/nextcloud_storage_spec.rb
index 46e9dcc6154..90e7012a205 100644
--- a/modules/storages/spec/models/storages/nextcloud_storage_spec.rb
+++ b/modules/storages/spec/models/storages/nextcloud_storage_spec.rb
@@ -51,9 +51,9 @@ RSpec.describe Storages::NextcloudStorage do
expect do
storage.mark_as_healthy
end.to(change(storage, :health_changed_at).to(healthy_time)
- .and(change(storage, :health_status).from('unconfigured').to('healthy')))
- expect(storage.healthy?).to be(true)
- expect(storage.unhealthy?).to be(false)
+ .and(change(storage, :health_status).from('pending').to('healthy')))
+ expect(storage.health_healthy?).to be(true)
+ expect(storage.health_unhealthy?).to be(false)
end
Timecop.freeze(unhealthy_time) do
@@ -63,8 +63,8 @@ RSpec.describe Storages::NextcloudStorage do
.and(change(storage, :health_status).from('healthy').to('unhealthy'))
.and(change(storage, :health_reason).from(nil).to('thou_shall_not_pass_error')))
end
- expect(storage.healthy?).to be(false)
- expect(storage.unhealthy?).to be(true)
+ expect(storage.health_healthy?).to be(false)
+ expect(storage.health_unhealthy?).to be(true)
end
end
diff --git a/modules/storages/spec/workers/storages/manage_nextcloud_integration_cron_job_spec.rb b/modules/storages/spec/workers/storages/manage_nextcloud_integration_cron_job_spec.rb
index fd235b43014..dfbccc86575 100644
--- a/modules/storages/spec/workers/storages/manage_nextcloud_integration_cron_job_spec.rb
+++ b/modules/storages/spec/workers/storages/manage_nextcloud_integration_cron_job_spec.rb
@@ -69,7 +69,7 @@ RSpec.describe Storages::ManageNextcloudIntegrationCronJob, :webmock, type: :job
storage1.reload
end.to(
change(storage1, :health_changed_at).to(Time.now.utc)
- .and(change(storage1, :health_status).from('unconfigured').to('healthy'))
+ .and(change(storage1, :health_status).from('pending').to('healthy'))
)
end
end
@@ -86,7 +86,7 @@ RSpec.describe Storages::ManageNextcloudIntegrationCronJob, :webmock, type: :job
storage1.reload
end.to(
change(storage1, :health_changed_at).to(Time.now.utc)
- .and(change(storage1, :health_status).from('unconfigured').to('unhealthy'))
+ .and(change(storage1, :health_status).from('pending').to('unhealthy'))
.and(change(storage1, :health_reason).from(nil).to('not_found'))
)
end