From d166e425013f224abf555d86861df5a211d542fb Mon Sep 17 00:00:00 2001 From: Jason Frey Date: Fri, 22 Jan 2021 17:58:43 -0500 Subject: [PATCH] Flatten worker settings --- app/models/miq_worker.rb | 82 +++--- config/settings.yml | 257 +++++++++--------- .../provider/templates/config/settings.yml | 15 +- lib/vmdb/settings/validator.rb | 13 + spec/lib/vmdb/settings/validator_spec.rb | 4 + .../miq_server/server_smart_proxy_spec.rb | 2 +- spec/models/miq_worker_spec.rb | 143 +++++----- .../mixins/per_ems_type_worker_mixin_spec.rb | 4 +- tools/configure_server_settings.rb | 2 +- 9 files changed, 267 insertions(+), 255 deletions(-) diff --git a/app/models/miq_worker.rb b/app/models/miq_worker.rb index 6348fe6d539..d1cdbd61dd4 100644 --- a/app/models/miq_worker.rb +++ b/app/models/miq_worker.rb @@ -152,63 +152,59 @@ def self.sync_workers result end - # Convert the Models name from MiqGenericWorker to :generic_worker + # Determine the settings key from a worker's class name def self.settings_name @settings_name ||= if self == MiqWorker :worker_base elsif module_parent.try(:short_token) - # :generic_worker_infra, :generic_worker_vmware + # ManageIQ::Providers::Vmware::InfraManager::RefreshWorker => :ems_refresh_worker_vmware :"#{normalized_type}_#{module_parent.short_token.underscore}" else - # :generic_worker + # MiqGenericWorker => :generic_worker normalized_type.to_sym end end - # Grab all the classes in the hierarchy below ActiveRecord::Base - def self.path_to_my_worker_settings - @path_to_my_worker_settings ||= - ancestors.grep(Class).select { |c| c <= MiqWorker }.reverse.collect(&:settings_name) + def self.fetch_worker_settings_from_server(miq_server, options = {}) + return {} if miq_server.nil? + + config = (options[:config] || miq_server.settings)[:workers] + return {} if config.nil? + + flatten_worker_settings(config, options[:raw]) end - def self.fetch_worker_settings_from_server(miq_server, options = {}) - settings = {} - - unless miq_server.nil? - server_config = options[:config] || miq_server.settings - # Get the configuration values - section = server_config[:workers] - unless section.nil? - classes = path_to_my_worker_settings - classes.each do |c| - section = section[c] - raise _("Missing config section %{section_name}") % {:section_name => c} if section.nil? - defaults = section[:defaults] - settings.merge!(defaults) unless defaults.nil? - end + def self.flatten_worker_settings(config, raw = false) + layers = [] + key = settings_name + while key + layer = config[key.to_sym] + layers.unshift(layer) + key = layer[:inherits_from] + end - settings.merge!(section) + {}.tap do |settings| + layers.each { |l| settings.merge!(l) } + resolve_worker_settings_values!(settings) if raw != true + end + end - # If not specified, provide the worker_settings cleaned up in fixnums, etc. instead of 1.seconds, 10.megabytes - raw = options[:raw] == true + # Resolve the settings values stored as strings or in method format into a number + # + # "1.megabyte" => 1_048_576 + # "1_048_576" => 1_048_576 + # "1_048_576.0" => 1_048_576 + private_class_method def self.resolve_worker_settings_values!(settings) + settings.keys.each do |k| + next unless settings[k].kind_of?(String) - # Clean up the configuration values in a format like "30.seconds" - unless raw - settings.keys.each do |k| - if settings[k].kind_of?(String) - if settings[k].number_with_method? - settings[k] = settings[k].to_i_with_method - elsif settings[k] =~ /\A\d+(.\d+)?\z/ # case where int/float saved as string - settings[k] = settings[k].to_i - end - end - end - end + if settings[k].number_with_method? + settings[k] = settings[k].to_i_with_method + elsif settings[k] =~ /\A\d+(.\d+)?\z/ # case where int/float saved as string + settings[k] = settings[k].to_i end end - - settings end def worker_settings(options = {}) @@ -528,14 +524,6 @@ def update_heartbeat update_attribute(:last_heartbeat, Time.now.utc) end - def self.config_settings_path - @config_settings_path ||= [:workers] + path_to_my_worker_settings - end - - class << self - attr_writer :config_settings_path - end - def update_spid(spid = ActiveRecord::Base.connection.spid) self.sql_spid = spid end diff --git a/config/settings.yml b/config/settings.yml index 97f136d3097..faac22a5d8d 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -1048,127 +1048,138 @@ :authentication_timeout: 30.seconds :url: :workers: + :cockpit_ws_worker: + :count: 1 + :inherits_from: worker_base + :ems_metrics_collector_worker: + :count: 2 + :inherits_from: queue_worker_base + :nice_delta: 3 + :poll_method: escalate + :ems_metrics_processor_worker: + :count: 2 + :inherits_from: queue_worker_base + :memory_threshold: 800.megabytes + :nice_delta: 7 + :poll_method: escalate + :ems_operations_worker: + :inherits_from: queue_worker_base + :ems_refresh_worker: + :dequeue_method: sql + :inherits_from: queue_worker_base + :memory_threshold: 2.gigabytes + :nice_delta: 7 + :poll: 10.seconds + :poll_method: normal + :queue_timeout: 120.minutes + :event_catcher: + :ems_event_page_size: 100 + :ems_event_thread_shutdown_timeout: 10.seconds + :flooding_events_per_minute: 30 + :flooding_monitor_enabled: false + :inherits_from: worker_base + :memory_threshold: 2.gigabytes + :nice_delta: 1 + :poll: 1.seconds + :event_handler: + :inherits_from: queue_worker_base + :nice_delta: 7 + :generic_worker: + :count: 2 + :inherits_from: queue_worker_base + :priority_worker: + :count: 2 + :inherits_from: queue_worker_base + :nice_delta: 1 + :poll: 1.seconds + :queue_worker_base: + :dequeue_method: drb + :inherits_from: worker_base + :poll_method: normal + :queue_timeout: 10.minutes + :remote_console_worker: + :connection_pool_size: 14 + :inherits_from: worker_base + :memory_threshold: 1.gigabytes + :nice_delta: 1 + :reporting_worker: + :count: 2 + :inherits_from: queue_worker_base + :nice_delta: 7 + :schedule_worker: + :audit_managed_resources: 1.days + :authentication_check_interval: 1.hour + :binary_blob_purge_interval: 1.hour + :chargeback_generation_interval: 1.day + :chargeback_generation_time_utc: 01:00:00 + :compliance_purge_interval: 1.day + :container_entities_purge_interval: 1.day + :db_diagnostics_interval: 30.minutes + :drift_state_purge_interval: 1.day + :event_streams_purge_interval: 1.day + :evm_snapshot_delete_delay_for_job_not_found: 1.hour + :evm_snapshot_interval: 1.hour + :inherits_from: worker_base + :job_proxy_dispatcher_interval: 15.seconds + :job_proxy_dispatcher_stale_message_check_interval: 60.seconds + :job_proxy_dispatcher_stale_message_timeout: 2.minutes + :job_timeout_interval: 60.seconds + :log_active_configuration_interval: 1.days + :memory_threshold: 500.megabytes + :nice_delta: 3 + :notifications_purge_interval: 1.day + :orchestration_stack_retired_interval: 10.minutes + :performance_collection_interval: 3.minutes + :performance_collection_start_delay: 5.minutes + :performance_realtime_purging_interval: 21.minutes + :performance_realtime_purging_start_delay: 5.minutes + :performance_rollup_purging_interval: 4.hours + :performance_rollup_purging_start_delay: 5.minutes + :policy_events_purge_interval: 1.day + :poll: 15.seconds + :queue_timeout_interval: 15.seconds + :report_result_purge_interval: 1.week + :server_log_stats_interval: 5.minutes + :server_stats_interval: 60.seconds + :service_retired_interval: 10.minutes + :session_timeout_interval: 30.seconds + :storage_file_collection_interval: 1.days + :storage_file_collection_time_utc: 21600 + :task_purge_interval: 1.day + :task_timeout_check_frequency: 1.hour + :vim_performance_states_purge_interval: 1.day + :vm_retired_interval: 10.minutes + :yum_update_check: 12.hours + :smart_proxy_worker: + :count: 2 + :heartbeat_thread_shutdown_timeout: 10.seconds + :inherits_from: queue_worker_base + :memory_threshold: 2.gigabytes + :queue_timeout: 20.minutes + :ui_worker: + :connection_pool_size: 8 + :inherits_from: worker_base + :memory_threshold: 1.gigabytes + :nice_delta: 1 + :web_service_worker: + :connection_pool_size: 8 + :inherits_from: worker_base + :memory_threshold: 1.gigabytes + :nice_delta: 1 :worker_base: - :defaults: - :count: 1 - :cpu_request_percent: 15 - :cpu_threshold_percent: 100 - :gc_interval: 15.minutes - :heartbeat_freq: 10.seconds - :heartbeat_timeout: 2.minutes - :memory_request: 500.megabytes - :memory_threshold: 600.megabytes - :nice_delta: 10 - :parent_time_threshold: 3.minutes - :poll: 3.seconds - :poll_escalate_max: 30.seconds - :poll_method: normal - :starting_timeout: 10.minutes - :stopping_timeout: 10.minutes - :systemd_enabled: true - :event_catcher: - :defaults: - :flooding_events_per_minute: 30 - :flooding_monitor_enabled: false - :ems_event_page_size: 100 - :ems_event_thread_shutdown_timeout: 10.seconds - :memory_threshold: 2.gigabytes - :nice_delta: 1 - :poll: 1.seconds - :queue_worker_base: - :defaults: - :dequeue_method: drb - :poll_method: normal - :queue_timeout: 10.minutes - :ems_metrics_collector_worker: - :defaults: - :count: 2 - :nice_delta: 3 - :poll_method: escalate - :ems_metrics_processor_worker: - :count: 2 - :memory_threshold: 800.megabytes - :nice_delta: 7 - :poll_method: escalate - :ems_operations_worker: {} - :ems_refresh_worker: - :defaults: - :memory_threshold: 2.gigabytes - :nice_delta: 7 - :poll: 10.seconds - :poll_method: normal - :queue_timeout: 120.minutes - :dequeue_method: sql - :event_handler: - :nice_delta: 7 - :generic_worker: - :count: 2 - :priority_worker: - :count: 2 - :nice_delta: 1 - :poll: 1.seconds - :reporting_worker: - :count: 2 - :nice_delta: 7 - :smart_proxy_worker: - :count: 2 - :memory_threshold: 2.gigabytes - :queue_timeout: 20.minutes - :heartbeat_thread_shutdown_timeout: 10.seconds - :schedule_worker: - :audit_managed_resources: 1.days - :container_entities_purge_interval: 1.day - :binary_blob_purge_interval: 1.hour - :authentication_check_interval: 1.hour - :chargeback_generation_interval: 1.day - :chargeback_generation_time_utc: 01:00:00 - :compliance_purge_interval: 1.day - :db_diagnostics_interval: 30.minutes - :drift_state_purge_interval: 1.day - :event_streams_purge_interval: 1.day - :evm_snapshot_delete_delay_for_job_not_found: 1.hour - :evm_snapshot_interval: 1.hour - :job_proxy_dispatcher_interval: 15.seconds - :job_proxy_dispatcher_stale_message_check_interval: 60.seconds - :job_proxy_dispatcher_stale_message_timeout: 2.minutes - :job_timeout_interval: 60.seconds - :log_active_configuration_interval: 1.days - :memory_threshold: 500.megabytes - :nice_delta: 3 - :notifications_purge_interval: 1.day - :orchestration_stack_retired_interval: 10.minutes - :performance_collection_interval: 3.minutes - :performance_collection_start_delay: 5.minutes - :performance_realtime_purging_interval: 21.minutes - :performance_realtime_purging_start_delay: 5.minutes - :performance_rollup_purging_interval: 4.hours - :performance_rollup_purging_start_delay: 5.minutes - :policy_events_purge_interval: 1.day - :poll: 15.seconds - :queue_timeout_interval: 15.seconds - :report_result_purge_interval: 1.week - :server_log_stats_interval: 5.minutes - :server_stats_interval: 60.seconds - :service_retired_interval: 10.minutes - :session_timeout_interval: 30.seconds - :storage_file_collection_interval: 1.days - :storage_file_collection_time_utc: 21600 - :task_purge_interval: 1.day - :task_timeout_check_frequency: 1.hour - :vim_performance_states_purge_interval: 1.day - :vm_retired_interval: 10.minutes - :yum_update_check: 12.hours - :ui_worker: - :connection_pool_size: 8 - :memory_threshold: 1.gigabytes - :nice_delta: 1 - :web_service_worker: - :connection_pool_size: 8 - :memory_threshold: 1.gigabytes - :nice_delta: 1 - :remote_console_worker: - :connection_pool_size: 14 - :memory_threshold: 1.gigabytes - :nice_delta: 1 - :cockpit_ws_worker: - :count: 1 + :count: 1 + :cpu_request_percent: 15 + :cpu_threshold_percent: 100 + :gc_interval: 15.minutes + :heartbeat_freq: 10.seconds + :heartbeat_timeout: 2.minutes + :memory_request: 500.megabytes + :memory_threshold: 600.megabytes + :nice_delta: 10 + :parent_time_threshold: 3.minutes + :poll: 3.seconds + :poll_escalate_max: 30.seconds + :poll_method: :normal + :starting_timeout: 10.minutes + :stopping_timeout: 10.minutes + :systemd_enabled: true diff --git a/lib/generators/manageiq/provider/templates/config/settings.yml b/lib/generators/manageiq/provider/templates/config/settings.yml index a5edd626945..7566e911c5b 100644 --- a/lib/generators/manageiq/provider/templates/config/settings.yml +++ b/lib/generators/manageiq/provider/templates/config/settings.yml @@ -22,13 +22,10 @@ :level_<%= provider_name %>: info <% if options[:scaffolding] -%> :workers: - :worker_base: - :event_catcher: - :event_catcher_<%= provider_name %>: - :poll: 20.seconds - :queue_worker_base: - :ems_metrics_collector_worker: - :ems_metrics_collector_worker_<%= provider_name %>: {} - :ems_refresh_worker: - :ems_refresh_worker_<%= provider_name %>: {} + :event_catcher_<%= provider_name %>: + :inherits_from: event_catcher + :ems_metrics_collector_worker_<%= provider_name %>: + :inherits_from: ems_metrics_collector_worker + :ems_refresh_worker_<%= provider_name %>: + :inherits_from: ems_refresh_worker <% end -%> diff --git a/lib/vmdb/settings/validator.rb b/lib/vmdb/settings/validator.rb index 84d805a8bff..3e275111c7e 100644 --- a/lib/vmdb/settings/validator.rb +++ b/lib/vmdb/settings/validator.rb @@ -167,6 +167,19 @@ def smtp(data) return valid, errors end + + def workers(data) + valid, errors = true, [] + + data.each_pair do |worker, worker_settings| + if worker_settings.include?(:inherits_from) && worker_settings[:inherits_from] != ::Settings.workers[worker].inherits_from + valid = false + errors << ["#{worker}-inherits_from", "cannot be modified"] + end + end + + return valid, errors + end end end end diff --git a/spec/lib/vmdb/settings/validator_spec.rb b/spec/lib/vmdb/settings/validator_spec.rb index d1afd98b7f3..f69e5275df3 100644 --- a/spec/lib/vmdb/settings/validator_spec.rb +++ b/spec/lib/vmdb/settings/validator_spec.rb @@ -67,6 +67,10 @@ {:smtp => {:from => "a@example.com"}}, true, {:smtp => {:from => "xxx"}}, false, + + {:workers => {:worker_base => {:inherits_from => "xxx"}}}, false, + {:workers => {:ui_worker => {:inherits_from => "worker_base"}}}, true, + {:workers => {:ui_worker => {:inherits_from => "xxx"}}}, false, ].freeze VALIDATOR_CASES.each_slice(2) do |c, expected| diff --git a/spec/models/miq_server/server_smart_proxy_spec.rb b/spec/models/miq_server/server_smart_proxy_spec.rb index f823e0f6376..3feba6a51d1 100644 --- a/spec/models/miq_server/server_smart_proxy_spec.rb +++ b/spec/models/miq_server/server_smart_proxy_spec.rb @@ -25,7 +25,7 @@ it "is the number of smart proxy workers when the role is active" do server.role = "smartproxy" server.assigned_server_roles.update(:active => true) - stub_settings(:workers => {:worker_base => {:queue_worker_base => {:smart_proxy_worker => {:count => 5}}}}) + stub_settings_merge(:workers => {:smart_proxy_worker => {:count => 5}}) expect(server.concurrent_job_max).to eq(5) end diff --git a/spec/models/miq_worker_spec.rb b/spec/models/miq_worker_spec.rb index 396fdc50b2e..1872bc6f0ef 100644 --- a/spec/models/miq_worker_spec.rb +++ b/spec/models/miq_worker_spec.rb @@ -135,20 +135,25 @@ def check_has_required_role(worker_role_names, expected_result) let(:settings) do { :workers => { - :worker_base => { - :defaults => {:memory_threshold => "100.megabytes"}, - :queue_worker_base => { - :defaults => {:memory_threshold => "300.megabytes"}, - :ems_refresh_worker => { - :defaults => {:memory_threshold => "500.megabytes"}, - :ems_refresh_worker_amazon => { - :memory_threshold => "700.megabytes" - } - } - } + :worker_base => { + :memory_threshold => "100.megabytes" + }, + :queue_worker_base => { + :inherits_from => "worker_base", + :memory_threshold => "300.megabytes" + }, + :ems_refresh_worker => { + :inherits_from => "queue_worker_base", + :memory_threshold => "500.megabytes" + }, + :ems_refresh_worker_amazon => { + :inherits_from => "ems_refresh_worker", + :memory_threshold => "700.megabytes" } }, - :ems => {:ems_amazon => {}} + :ems => { + :ems_amazon => {} + } } end @@ -165,7 +170,7 @@ def check_has_required_role(worker_role_names, expected_result) end it "without overrides" do - settings.store_path(:workers, :worker_base, :queue_worker_base, :ems_refresh_worker, :ems_refresh_worker_amazon, {}) + settings.delete_path(:workers, :ems_refresh_worker_amazon, :memory_threshold) stub_settings(settings) expect(actual).to eq(500.megabytes) @@ -179,7 +184,8 @@ def check_has_required_role(worker_role_names, expected_result) end it "without overrides" do - settings.store_path(:workers, :worker_base, :queue_worker_base, :ems_refresh_worker, :defaults, {}) + settings.delete_path(:workers, :ems_refresh_worker_amazon, :memory_threshold) + settings.delete_path(:workers, :ems_refresh_worker, :memory_threshold) stub_settings(settings) expect(actual).to eq(300.megabytes) @@ -193,7 +199,9 @@ def check_has_required_role(worker_role_names, expected_result) end it "without overrides" do - settings.store_path(:workers, :worker_base, :queue_worker_base, :defaults, {}) + settings.delete_path(:workers, :ems_refresh_worker_amazon, :memory_threshold) + settings.delete_path(:workers, :ems_refresh_worker, :memory_threshold) + settings.delete_path(:workers, :queue_worker_base, :memory_threshold) stub_settings(settings) expect(actual).to eq(100.megabytes) @@ -205,20 +213,25 @@ def check_has_required_role(worker_role_names, expected_result) let(:settings) do { :workers => { - :worker_base => { - :defaults => {:memory_threshold => "100.megabytes"}, - :queue_worker_base => { - :defaults => {:memory_threshold => 314_572_800}, # 300.megabytes - :ems_refresh_worker => { - :defaults => {:memory_threshold => "524288000"}, # 500.megabytes - :ems_refresh_worker_amazon => { - :memory_threshold => "1181116006.4" # 1.1.gigabtye - } - } - } + :worker_base => { + :memory_threshold => "100.megabytes" + }, + :queue_worker_base => { + :inherits_from => "worker_base", + :memory_threshold => 314_572_800 # 300.megabytes + }, + :ems_refresh_worker => { + :inherits_from => "queue_worker_base", + :memory_threshold => "524288000" # 500.megabytes + }, + :ems_refresh_worker_amazon => { + :inherits_from => "ems_refresh_worker", + :memory_threshold => "1181116006.4" # 1.1.gigabtyes } }, - :ems => {:ems_amazon => {}} + :ems => { + :ems_amazon => {} + } } end @@ -241,12 +254,10 @@ def check_has_required_role(worker_role_names, expected_result) end it "uses passed in config" do - settings.store_path(:workers, :worker_base, :queue_worker_base, :ems_refresh_worker, - :ems_refresh_worker_amazon, :memory_threshold, "5.terabyte") + settings.store_path(:workers, :ems_refresh_worker_amazon, :memory_threshold, "5.terabyte") stub_settings(settings) - settings.store_path(:workers, :worker_base, :queue_worker_base, :ems_refresh_worker, - :ems_refresh_worker_amazon, :memory_threshold, "1.terabyte") + settings.store_path(:workers, :ems_refresh_worker_amazon, :memory_threshold, "1.terabyte") actual = ManageIQ::Providers::Amazon::CloudManager::RefreshWorker .worker_settings(:config => settings)[:memory_threshold] expect(actual).to eq(1.terabyte) @@ -274,17 +285,20 @@ def check_has_required_role(worker_role_names, expected_result) let(:config1) do { :workers => { - :worker_base => { - :defaults => {:memory_threshold => "100.megabytes"}, - :queue_worker_base => { - :defaults => {:memory_threshold => "300.megabytes"}, - :ems_refresh_worker => { - :defaults => {:memory_threshold => "500.megabytes"}, - :ems_refresh_worker_amazon => { - :memory_threshold => "700.megabytes" - } - } - } + :worker_base => { + :memory_threshold => "100.megabytes" + }, + :queue_worker_base => { + :inherits_from => "worker_base", + :memory_threshold => "300.megabytes" + }, + :ems_refresh_worker => { + :inherits_from => "queue_worker_base", + :memory_threshold => "500.megabytes" + }, + :ems_refresh_worker_amazon => { + :inherits_from => "ems_refresh_worker", + :memory_threshold => "700.megabytes" } } } @@ -293,17 +307,20 @@ def check_has_required_role(worker_role_names, expected_result) let(:config2) do { :workers => { - :worker_base => { - :defaults => {:memory_threshold => "200.megabytes"}, - :queue_worker_base => { - :defaults => {:memory_threshold => "400.megabytes"}, - :ems_refresh_worker => { - :defaults => {:memory_threshold => "600.megabytes"}, - :ems_refresh_worker_amazon => { - :memory_threshold => "800.megabytes" - } - } - } + :worker_base => { + :memory_threshold => "200.megabytes" + }, + :queue_worker_base => { + :inherits_from => "worker_base", + :memory_threshold => "400.megabytes" + }, + :ems_refresh_worker => { + :inherits_from => "queue_worker_base", + :memory_threshold => "600.megabytes" + }, + :ems_refresh_worker_amazon => { + :inherits_from => "ems_refresh_worker", + :memory_threshold => "800.megabytes" } } } @@ -326,7 +343,7 @@ def check_has_required_role(worker_role_names, expected_result) it "without overrides" do @server.settings_changes.where( - :key => "/workers/worker_base/queue_worker_base/ems_refresh_worker/ems_refresh_worker_amazon/memory_threshold" + :key => "/workers/ems_refresh_worker_amazon/memory_threshold" ).delete_all expect(@worker.worker_settings[:memory_threshold]).to eq(500.megabytes) expect(@worker2.worker_settings[:memory_threshold]).to eq(800.megabytes) @@ -334,24 +351,6 @@ def check_has_required_role(worker_role_names, expected_result) end end - describe ".config_settings_path" do - let(:capu_worker) do - ManageIQ::Providers::Amazon::CloudManager::MetricsCollectorWorker - end - - it "include parent entries" do - expect(capu_worker.config_settings_path).to eq( - %i(workers worker_base queue_worker_base ems_metrics_collector_worker ems_metrics_collector_worker_amazon) - ) - end - - it "works for high level entries" do - expect(MiqEmsMetricsCollectorWorker.config_settings_path).to eq( - %i(workers worker_base queue_worker_base ems_metrics_collector_worker) - ) - end - end - context "instance" do before do allow(described_class).to receive(:nice_increment).and_return("+10") diff --git a/spec/models/mixins/per_ems_type_worker_mixin_spec.rb b/spec/models/mixins/per_ems_type_worker_mixin_spec.rb index 1fa28e74e5e..bfd0406261c 100644 --- a/spec/models/mixins/per_ems_type_worker_mixin_spec.rb +++ b/spec/models/mixins/per_ems_type_worker_mixin_spec.rb @@ -29,14 +29,14 @@ configured = worker_class.workers_configured_count expect(worker_class.workers).to eq(configured) - stub_settings(:workers => {:worker_base => {:queue_worker_base => {:ems_metrics_collector_worker => {:count => configured + 1}}}}) + stub_settings_merge(:workers => {:ems_metrics_collector_worker => {:count => configured + 1}}) expect(worker_class.workers).to eq(configured + 1) end it "is 0 with the provider in the wrong zone" do other_zone = FactoryBot.create(:zone) provider.update(:zone => other_zone) - stub_settings(:workers => {:worker_base => {:queue_worker_base => {:ems_metrics_collector_worker => {:count => 5}}}}) + stub_settings_merge(:workers => {:ems_metrics_collector_worker => {:count => 5}}) expect(worker_class.workers).to eq(0) end diff --git a/tools/configure_server_settings.rb b/tools/configure_server_settings.rb index b417bf2d91b..82cee9b5193 100755 --- a/tools/configure_server_settings.rb +++ b/tools/configure_server_settings.rb @@ -7,7 +7,7 @@ opts = Optimist.options(ARGV) do banner "USAGE: #{__FILE__} -s -p -v \n" \ "Example (String): #{__FILE__} -s 1 -p reporting/history/keep_reports -v 3.months\n" \ - "Example (Integer): #{__FILE__} -s 1 -p workers/worker_base/queue_worker_base/ems_metrics_collector_worker/defaults/count -v 1 -t integer\n" \ + "Example (Integer): #{__FILE__} -s 1 -p workers/ems_metrics_collector_worker/defaults/count -v 1 -t integer\n" \ "Example (Boolean): #{__FILE__} -s 1 -p ui/mark_translated_strings -v true -t boolean\n" \ "Example (Float): #{__FILE__} -s 1 -p capacity/profile/1/vcpu_commitment_ratio -v 1.5 -t float" \