diff --git a/Gemfile b/Gemfile index c10b08195bc..13ba3c9162f 100644 --- a/Gemfile +++ b/Gemfile @@ -66,8 +66,8 @@ gem "pg", :require => false gem "pg-dsn_parser", "~>0.1.0", :require => false gem "psych", "~>3.1", :require => false # This can be dropped once we drop ruby 2.5 gem "query_relation", "~>0.1.0", :require => false -gem "rails", "~>5.2.4", ">=5.2.4.4" -gem "rails-i18n", "~>5.x" +gem "rails", "~>6.0.0" +gem "rails-i18n", "~>6.x" gem "rake", ">=12.3.3", :require => false gem "rest-client", "~>2.1.0", :require => false gem "ripper_ruby_parser", "~>1.5.1", :require => false @@ -76,7 +76,7 @@ gem "rubyzip", "~>2.0.0", :require => false gem "rugged", "~>1.1", :require => false gem "snmp", "~>1.2.0", :require => false gem "sprockets", "~>3.7.2", :require => false -gem "sqlite3", "~>1.3.0", :require => false +gem "sqlite3", "~>1.4.0", :require => false gem "sync", "~>0.5", :require => false gem "sys-filesystem", "~>1.3.4" gem "terminal", :require => false @@ -233,7 +233,7 @@ group :ui_dependencies do # Added to Bundler.require in config/application.rb manageiq_plugin "manageiq-decorators" manageiq_plugin "manageiq-ui-classic" # Modified gems (forked on Github) - gem "jquery-rjs", "=0.1.1.1", :source => "https://rubygems.manageiq.org" + gem "jquery-rjs", "=0.1.1.2", :source => "https://rubygems.manageiq.org" end group :v2v, :ui_dependencies do @@ -242,7 +242,7 @@ end group :web_server, :manageiq_default do gem "puma", "~>4.2" - gem "responders", "~>2.0" + gem "responders", "~>3.0" gem "ruby-dbus" # For external auth gem "secure_headers", "~>3.9" end diff --git a/app/models/classification.rb b/app/models/classification.rb index a5bdaaf97a6..f2465217cc1 100644 --- a/app/models/classification.rb +++ b/app/models/classification.rb @@ -508,7 +508,10 @@ def self.add_entries_from_hash(cat, entries) def validate_uniqueness_on_tag_name tag_name = Classification.name2tag(name, parent, ns) - exist_scope = Classification.includes(:tag).where(:tags => {:name => tag_name}).merge(Tag.in_region(region_id)) + exist_scope = Classification.default_scoped + .includes(:tag) + .where(:tags => {:name => tag_name}) + .merge(Tag.in_region(region_id)) exist_scope = exist_scope.where.not(:id => id) unless new_record? errors.add("name", "has already been taken") if exist_scope.exists? diff --git a/app/models/disk.rb b/app/models/disk.rb index 79ed944fdd8..db123da7131 100644 --- a/app/models/disk.rb +++ b/app/models/disk.rb @@ -14,6 +14,26 @@ class Disk < ApplicationRecord t.grouping(Arel::Nodes::NamedFunction.new('COALESCE', [t[:size_on_disk], t[:size], 0])) end) + # A performance improvement was introduced in Rails 6: + # + # https://github.com/rails/rails/commit/cc2d614e + # + # Causes the `present` column in this class to raise the following error: + # + # ActiveRecord::DangerousAttributeError: + # present? is defined by Active Record. Check to make sure that you don't + # have an attribute or method with the same name. + # + # Since there is no whitelist for this method, this attempts to circumvent + # that autogenerated error to allow our previously named column to still work + # properly. + # + def self.dangerous_attribute_method?(name) + return if name == "present?" + + super + end + def self.find_hard_disks where("device_type != 'floppy' AND device_type NOT LIKE '%cdrom%'").to_a end diff --git a/app/models/ext_management_system.rb b/app/models/ext_management_system.rb index 5f03bd92448..ed8813d3cfe 100644 --- a/app/models/ext_management_system.rb +++ b/app/models/ext_management_system.rb @@ -410,12 +410,12 @@ def self.model_from_emstype(emstype) def self.short_token if self == ManageIQ::Providers::BaseManager nil - elsif parent == ManageIQ::Providers + elsif module_parent == ManageIQ::Providers # "Infra" name.demodulize.sub(/Manager$/, '') - elsif parent != Object + elsif module_parent != Object # "Vmware" - parent.name.demodulize + module_parent.name.demodulize end end diff --git a/app/models/guest_device.rb b/app/models/guest_device.rb index 492c768eaf1..717e1deaa11 100644 --- a/app/models/guest_device.rb +++ b/app/models/guest_device.rb @@ -23,6 +23,26 @@ class GuestDevice < ApplicationRecord acts_as_miq_taggable + # A performance improvement was introduced in Rails 6: + # + # https://github.com/rails/rails/commit/cc2d614e + # + # Causes the `present` column in this class to raise the following error: + # + # ActiveRecord::DangerousAttributeError: + # present? is defined by Active Record. Check to make sure that you don't + # have an attribute or method with the same name. + # + # Since there is no whitelist for this method, this attempts to circumvent + # that autogenerated error to allow our previously named column to still work + # properly. + # + def self.dangerous_attribute_method?(name) + return if name == "present?" + + super + end + def self.with_ethernet_type where(:device_type => "ethernet") end diff --git a/app/models/manageiq/providers/cloud_manager/provision/cloning.rb b/app/models/manageiq/providers/cloud_manager/provision/cloning.rb index c025e3367ba..5f6cfe6bcd2 100644 --- a/app/models/manageiq/providers/cloud_manager/provision/cloning.rb +++ b/app/models/manageiq/providers/cloud_manager/provision/cloning.rb @@ -4,7 +4,7 @@ def find_destination_in_vmdb(ems_ref) end def vm_model_class - self.class.parent::Vm + self.class.module_parent::Vm end def validate_dest_name diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb index fdf2eb3584a..c71ed47a102 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb @@ -84,7 +84,7 @@ def sync current = configuration_script_payloads.index_by(&:name) playbooks_in_git_repository.each do |f| - found = current.delete(f) || self.class.parent::Playbook.new(:configuration_script_source_id => id) + found = current.delete(f) || self.class.module_parent::Playbook.new(:configuration_script_source_id => id) found.update!(:name => f, :manager_id => manager_id) end diff --git a/app/models/manageiq/providers/embedded_ansible/crud_common.rb b/app/models/manageiq/providers/embedded_ansible/crud_common.rb index 376d178c4be..adeb4fcc419 100644 --- a/app/models/manageiq/providers/embedded_ansible/crud_common.rb +++ b/app/models/manageiq/providers/embedded_ansible/crud_common.rb @@ -50,7 +50,7 @@ def encrypt_queue_params(params) end def create_in_provider_queue(manager_id, params, auth_user = nil) - parent.find(manager_id) # validation that the manager ID is from EmbeddedAnsible + module_parent.find(manager_id) # validation that the manager ID is from EmbeddedAnsible action = "Creating #{self::FRIENDLY_NAME}" action << " (name=#{params[:name]})" if params[:name] queue(nil, "create_in_provider", [manager_id, encrypt_queue_params(params)], action, auth_user) diff --git a/app/models/manageiq/providers/inflector.rb b/app/models/manageiq/providers/inflector.rb index d5716060690..920bbf06bed 100644 --- a/app/models/manageiq/providers/inflector.rb +++ b/app/models/manageiq/providers/inflector.rb @@ -17,6 +17,6 @@ def self.provider_module(klass, original_object = nil) raise ObjectNotNamespacedError, "Cannot get provider module from non namespaced object #{original_object}" end - klass.parent == ManageIQ::Providers ? klass : provider_module(klass.parent, klass) + klass.module_parent == ManageIQ::Providers ? klass : provider_module(klass.module_parent, klass) end end diff --git a/app/models/metric/ci_mixin.rb b/app/models/metric/ci_mixin.rb index 5cf9a3aabf5..e8a4db5087a 100644 --- a/app/models/metric/ci_mixin.rb +++ b/app/models/metric/ci_mixin.rb @@ -21,7 +21,7 @@ module Metric::CiMixin end supports :capture do - metrics_capture_klass = "#{self.class.parent.name}::MetricsCapture".safe_constantize + metrics_capture_klass = "#{self.class.module_parent.name}::MetricsCapture".safe_constantize unless metrics_capture_klass&.method_defined?(:perf_collect_metrics) unsupported_reason_add(:capture, _('This provider does not support metrics collection')) end diff --git a/app/models/metric/ci_mixin/capture.rb b/app/models/metric/ci_mixin/capture.rb index c0f0eb308f5..7790ff10cce 100644 --- a/app/models/metric/ci_mixin/capture.rb +++ b/app/models/metric/ci_mixin/capture.rb @@ -3,7 +3,7 @@ def perf_capture_object(targets = nil) if self.kind_of?(ExtManagementSystem) self.class::MetricsCapture.new(targets, ext_management_system) else - self.class.parent::MetricsCapture.new(targets || self, ext_management_system) + self.class.module_parent::MetricsCapture.new(targets || self, ext_management_system) end end diff --git a/app/models/miq_group.rb b/app/models/miq_group.rb index 39b38eedf22..7d4673d3011 100644 --- a/app/models/miq_group.rb +++ b/app/models/miq_group.rb @@ -69,7 +69,32 @@ def self.with_roles_excluding(identifier) end def self.next_sequence - maximum(:sequence).to_i + 1 + # The +(current_scope || self)+ here is a result of a Rails 6.0 deprecation + # warning that is added here: + # + # https://github.com/rails/rails/pull/35280 + # + # This was an attempt to fix "leaking scopes", however, in our case, we use + # this method both for our +default_value_for(:sequence)+, and it will get + # used as part of +.create_tenant_group+. + # + # As such, we need both +.current_scope+ for when we want to scope down the + # +.next_sequence+, but also well allow it to be used on a raw +.create+ + # without scopes. + # + # Our +.current_scope+ use case can be best described via one our of + # +MiqGroup+ specs: + # + # expect(MiqGroup.next_sequence).to be < 999 # sanity check + # + # FactoryBot.create(:miq_group, :description => "want 1", :sequence => 999) + # FactoryBot.create(:miq_group, :description => "want 2", :sequence => 1000) + # FactoryBot.create(:miq_group, :description => "dont want", :sequence => 1009) + # + # expect(MiqGroup.where("description like 'want%'").next_sequence).to eq(1001) + # + # + (current_scope || self).maximum(:sequence).to_i + 1 end def self.seed diff --git a/app/models/miq_region_remote.rb b/app/models/miq_region_remote.rb index ec1a2bc6d10..06cee7e5355 100644 --- a/app/models/miq_region_remote.rb +++ b/app/models/miq_region_remote.rb @@ -84,7 +84,7 @@ def self.with_remote_connection(host, port, username, password, database, adapte host = host.to_s.strip raise ArgumentError, _("host cannot be blank") if host.blank? if [nil, "", "localhost", "localhost.localdomain", "127.0.0.1", "0.0.0.0"].include?(host) - local_database = ActiveRecord::Base.configurations.fetch_path(Rails.env, "database").to_s.strip + local_database = (ActiveRecord::Base.configurations[Rails.env] || {})["database"].to_s.strip if database == local_database raise ArgumentError, _("host cannot be set to localhost if database matches the local database") end diff --git a/app/models/miq_server/environment_management.rb b/app/models/miq_server/environment_management.rb index ce37dfbe1a9..996a138d004 100644 --- a/app/models/miq_server/environment_management.rb +++ b/app/models/miq_server/environment_management.rb @@ -74,7 +74,7 @@ def check_disk_usage(disks) end next unless disk_usage_event - msg = "Filesystem: #{disk[:filesystem]} (#{disk[:type]}) on #{disk[:mount_point]} is #{disk[:used_bytes_percent]}% full with #{ActionView::Base.new.number_to_human_size(disk[:available_bytes])} free." + msg = "Filesystem: #{disk[:filesystem]} (#{disk[:type]}) on #{disk[:mount_point]} is #{disk[:used_bytes_percent]}% full with #{ActionView::Base.empty.number_to_human_size(disk[:available_bytes])} free." MiqEvent.raise_evm_event_queue(self, disk_usage_event, :event_details => msg) end end diff --git a/app/models/miq_template.rb b/app/models/miq_template.rb index 1f44395318c..52c9264d125 100644 --- a/app/models/miq_template.rb +++ b/app/models/miq_template.rb @@ -17,7 +17,7 @@ def self.base_model end def self.corresponding_model - parent::Vm + module_parent::Vm end class << self; alias_method :corresponding_vm_model, :corresponding_model; end diff --git a/app/models/miq_worker.rb b/app/models/miq_worker.rb index f210ed42bc3..6348fe6d539 100644 --- a/app/models/miq_worker.rb +++ b/app/models/miq_worker.rb @@ -157,9 +157,9 @@ def self.settings_name @settings_name ||= if self == MiqWorker :worker_base - elsif parent.try(:short_token) + elsif module_parent.try(:short_token) # :generic_worker_infra, :generic_worker_vmware - :"#{normalized_type}_#{parent.short_token.underscore}" + :"#{normalized_type}_#{module_parent.short_token.underscore}" else # :generic_worker normalized_type.to_sym @@ -552,7 +552,7 @@ def worker_options end def self.normalized_type - @normalized_type ||= if parent == Object + @normalized_type ||= if module_parent == Object name.sub(/^Miq/, '').underscore else name.demodulize.underscore diff --git a/app/models/miq_worker/runner.rb b/app/models/miq_worker/runner.rb index b1ad503676b..9bc1fb4c14b 100644 --- a/app/models/miq_worker/runner.rb +++ b/app/models/miq_worker/runner.rb @@ -30,7 +30,7 @@ def poll_method=(val) end def self.corresponding_model - parent + module_parent end def initialize(cfg = {}) diff --git a/app/models/mixins/per_ems_type_worker_mixin.rb b/app/models/mixins/per_ems_type_worker_mixin.rb index 9389b6821b6..1df00cebab2 100644 --- a/app/models/mixins/per_ems_type_worker_mixin.rb +++ b/app/models/mixins/per_ems_type_worker_mixin.rb @@ -9,7 +9,7 @@ def workers end def ems_class - parent + module_parent end def emses_in_zone diff --git a/app/models/mixins/per_ems_worker_mixin.rb b/app/models/mixins/per_ems_worker_mixin.rb index 4b576eb46ce..c46c30cebf9 100644 --- a/app/models/mixins/per_ems_worker_mixin.rb +++ b/app/models/mixins/per_ems_worker_mixin.rb @@ -11,7 +11,7 @@ module PerEmsWorkerMixin module ClassMethods def ems_class - parent + module_parent end def all_ems_in_zone diff --git a/app/models/service_ansible_tower.rb b/app/models/service_ansible_tower.rb index 48139c6bd55..3273144f7e2 100644 --- a/app/models/service_ansible_tower.rb +++ b/app/models/service_ansible_tower.rb @@ -9,7 +9,7 @@ class ServiceAnsibleTower < Service alias_method :job_options=, :stack_options= def launch_job - job_class = "#{job_template.class.parent.name}::#{job_template.class.stack_type}".constantize + job_class = "#{job_template.class.module_parent.name}::#{job_template.class.stack_type}".constantize options = job_options.with_indifferent_access.deep_merge( :extra_vars => { 'manageiq' => service_manageiq_env, diff --git a/app/models/vm.rb b/app/models/vm.rb index c46ac7b7494..ea35aee27b0 100644 --- a/app/models/vm.rb +++ b/app/models/vm.rb @@ -18,7 +18,7 @@ def self.corresponding_model if self == Vm MiqTemplate else - parent::Template + module_parent::Template end end class << self; alias_method :corresponding_template_model, :corresponding_model; end diff --git a/app/models/vm_or_template.rb b/app/models/vm_or_template.rb index e6425968562..781ab629aa0 100644 --- a/app/models/vm_or_template.rb +++ b/app/models/vm_or_template.rb @@ -296,10 +296,10 @@ def from_infra_manager? include StorageMixin def self.manager_class - if parent == Object + if module_parent == Object ExtManagementSystem else - parent + module_parent end end diff --git a/lib/evm_database.rb b/lib/evm_database.rb index 366d71996ce..2783e86e4d7 100644 --- a/lib/evm_database.rb +++ b/lib/evm_database.rb @@ -133,7 +133,7 @@ def self.seed_classes(classes) private_class_method :seed_classes def self.host - ActiveRecord::Base.configurations.fetch_path(ENV['RAILS_ENV'], 'host') + (ActiveRecord::Base.configurations[ENV['RAILS_ENV']] || {})['host'] end def self.local? diff --git a/lib/extensions/session_extension.rb b/lib/extensions/session_extension.rb index a38daa995a7..a41db3e9a92 100644 --- a/lib/extensions/session_extension.rb +++ b/lib/extensions/session_extension.rb @@ -2,6 +2,6 @@ class ActionDispatch::Request::Session include MoreCoreExtensions::Shared::Nested end -class ActionController::TestSession < Rack::Session::Abstract::SessionHash +class ActionController::TestSession < Rack::Session::Abstract::PersistedSecure::SecureSessionHash include MoreCoreExtensions::Shared::Nested end diff --git a/lib/tasks/evm_application.rb b/lib/tasks/evm_application.rb index fbf3a3c3105..4921ef5fa73 100644 --- a/lib/tasks/evm_application.rb +++ b/lib/tasks/evm_application.rb @@ -203,7 +203,10 @@ def self.encryption_key_valid? end def self.deployment_status - context = ActiveRecord::MigrationContext.new(Rails.application.config.paths["db/migrate"]) + migration_dir = Rails.application.config.paths["db/migrate"] + migration_conn = ::ActiveRecord::Base.connection.schema_migration + context = ActiveRecord::MigrationContext.new(migration_dir, migration_conn) + return "new_deployment" if context.current_version.zero? return "new_replica" if MiqServer.my_server.nil? return "upgrade" if context.needs_migration? diff --git a/lib/unique_within_region_validator.rb b/lib/unique_within_region_validator.rb index b0e20960b10..37d504819e6 100644 --- a/lib/unique_within_region_validator.rb +++ b/lib/unique_within_region_validator.rb @@ -16,7 +16,7 @@ def validate_each(record, attribute, value) return if value.nil? || !record.send("#{attribute}_changed?") match_case = options.key?(:match_case) ? options[:match_case] : true - record_base_class = record.class.base_class + record_base_class = record.class.base_class.default_scoped matches = if match_case record_base_class.where(attribute => value) diff --git a/spec/lib/miq_expression_spec.rb b/spec/lib/miq_expression_spec.rb index d30d0e04199..ae43bad1361 100644 --- a/spec/lib/miq_expression_spec.rb +++ b/spec/lib/miq_expression_spec.rb @@ -362,7 +362,7 @@ it "generates the SQL for an INCLUDES ANY with expression method" do sql, * = MiqExpression.new("INCLUDES ANY" => {"field" => "Vm-ipaddresses", "value" => "foo"}).to_sql expected_sql = <<-EXPECTED.strip_heredoc.split("\n").join(" ") - 1 = (SELECT 1 + 1 = (SELECT 1 FROM "hardwares" INNER JOIN "networks" ON "networks"."hardware_id" = "hardwares"."id" WHERE "hardwares"."vm_or_template_id" = "vms"."id" @@ -510,7 +510,7 @@ it "generates the SQL for multi level contains with a scope" do sql, _ = MiqExpression.new("CONTAINS" => {"field" => "ExtManagementSystem.clustered_hosts.operating_system-name", "value" => "RHEL"}).to_sql rslt = "\"ext_management_systems\".\"id\" IN (SELECT \"ext_management_systems\".\"id\" FROM \"ext_management_systems\" " \ - "INNER JOIN \"hosts\" ON \"hosts\".\"ems_id\" = \"ext_management_systems\".\"id\" AND \"hosts\".\"ems_cluster_id\" IS NOT NULL " \ + "INNER JOIN \"hosts\" ON \"hosts\".\"ems_cluster_id\" IS NOT NULL AND \"hosts\".\"ems_id\" = \"ext_management_systems\".\"id\" " \ "INNER JOIN \"operating_systems\" ON \"operating_systems\".\"host_id\" = \"hosts\".\"id\" " \ "WHERE \"operating_systems\".\"name\" = 'RHEL')" expect(sql).to eq(rslt) @@ -542,8 +542,13 @@ it "generates the SQL for a CONTAINS expression with field containing a scope" do sql, * = MiqExpression.new("CONTAINS" => {"field" => "Vm.users-name", "value" => "foo"}).to_sql - expected = "\"vms\".\"id\" IN (SELECT \"vms\".\"id\" FROM \"vms\" INNER JOIN \"accounts\" ON \"accounts\".\"vm_or_template_id\" = "\ - "\"vms\".\"id\" AND \"accounts\".\"accttype\" = 'user' WHERE \"accounts\".\"name\" = 'foo')" + expected = <<-EXPECTED.split("\n").map(&:strip).join(" ") + "vms"."id" IN (SELECT "vms"."id" + FROM "vms" + INNER JOIN "accounts" ON "accounts"."accttype" = 'user' + AND "accounts"."vm_or_template_id" = "vms"."id" + WHERE "accounts"."name" = 'foo') + EXPECTED expect(sql).to eq(expected) end diff --git a/spec/lib/rbac/filterer_spec.rb b/spec/lib/rbac/filterer_spec.rb index 50973da8ff0..68af23b5445 100644 --- a/spec/lib/rbac/filterer_spec.rb +++ b/spec/lib/rbac/filterer_spec.rb @@ -2082,8 +2082,8 @@ def get_rbac_results_for_and_expect_objects(klass, expected_objects) vm.tag_with(@tags.values.join(" "), :ns => "*") if i > 0 end - Vm.scope :group_scope, ->(group_num) { Vm.where("name LIKE ?", "Test Group #{group_num}%") } - Vm.scope :is_on, -> { Vm.where(:power_state => "on") } + Vm.scope :group_scope, ->(group_num) { Vm.default_scoped.where("name LIKE ?", "Test Group #{group_num}%") } + Vm.scope :is_on, -> { Vm.default_scoped.where(:power_state => "on") } end context ".search" do diff --git a/spec/models/dialog_field_serializer_spec.rb b/spec/models/dialog_field_serializer_spec.rb index 409b1c13db0..0100a3ccfe7 100644 --- a/spec/models/dialog_field_serializer_spec.rb +++ b/spec/models/dialog_field_serializer_spec.rb @@ -238,10 +238,10 @@ "resource_action" => "serialized resource action", "dialog_field_responders" => dialog_field_responders, "options" => { - :category_id => "123", - :category_name => "best category ever", - :category_description => "best category ever", - :force_single_value => true + "category_id" => "123", + "category_name" => "best category ever", + "category_description" => "best category ever", + "force_single_value" => true }, "default_value" => "[\"one\", \"two\"]", "values" => "values" diff --git a/spec/tools/radar/rollup_radar_mixin_spec.rb b/spec/tools/radar/rollup_radar_mixin_spec.rb index a73576e37de..c474344b187 100644 --- a/spec/tools/radar/rollup_radar_mixin_spec.rb +++ b/spec/tools/radar/rollup_radar_mixin_spec.rb @@ -102,8 +102,8 @@ def add_metrics(containers) end def check_results(results, expected) - results.sort_by! { |x| Time.parse(x['hourly_timestamp']).utc } - expected.sort_by! { |x| Time.parse(x['hourly_timestamp']).utc } + results.sort_by! { |x| x['hourly_timestamp'].utc } + expected.sort_by! { |x| x['hourly_timestamp'] } results.zip(expected).each do |result, expected_result| expect(result).to(include(expected_result)) @@ -133,12 +133,12 @@ def check_results(results, expected) exp = [{"label_name" => "com.redhat.component", "label_value" => "EAP7", "container_project_name" => container_project.name, - "hourly_timestamp" => "2012-09-01 00:00:00", + "hourly_timestamp" => Time.parse("2012-09-01 00:00:00 +0000").utc, "max_sum_used_cores" => 2.0}, {"label_name" => "com.redhat.component", "label_value" => "EAP7", "container_project_name" => container_project.name, - "hourly_timestamp" => "2012-09-01 01:00:00", + "hourly_timestamp" => Time.parse("2012-09-01 01:00:00 +0000").utc, "max_sum_used_cores" => 2.0}] check_results(results, exp) @@ -187,12 +187,12 @@ def check_results(results, expected) exp = [{"label_name" => "com.redhat.component", "label_value" => "EAP7", "container_project_name" => container_project.name, - "hourly_timestamp" => "2012-09-01 00:00:00", + "hourly_timestamp" => Time.parse("2012-09-01 00:00:00 +0000").utc, "max_sum_used_cores" => 1.0}, {"label_name" => "com.redhat.component", "label_value" => "EAP7", "container_project_name" => container_project.name, - "hourly_timestamp" => "2012-09-01 01:00:00", + "hourly_timestamp" => Time.parse("2012-09-01 01:00:00 +0000").utc, "max_sum_used_cores" => 1.0}] check_results(results, exp) @@ -236,12 +236,12 @@ def check_results(results, expected) exp = [{"label_name" => "com.redhat.component", "label_value" => "EAP7", "container_project_name" => container_project.name, - "hourly_timestamp" => "2012-09-01 00:00:00", + "hourly_timestamp" => Time.parse("2012-09-01 00:00:00 +0000").utc, "max_sum_used_cores" => 1.5}, {"label_name" => "com.redhat.component", "label_value" => "EAP7", "container_project_name" => container_project.name, - "hourly_timestamp" => "2012-09-01 01:00:00", + "hourly_timestamp" => Time.parse("2012-09-01 01:00:00 +0000").utc, "max_sum_used_cores" => 1.0}] check_results(results, exp) @@ -286,12 +286,12 @@ def check_results(results, expected) exp = [{"label_name" => "com.redhat.component_different", "label_value" => "EAP7", "container_project_name" => container_project.name, - "hourly_timestamp" => "2012-09-01 00:00:00", + "hourly_timestamp" => Time.parse("2012-09-01 00:00:00 +0000").utc, "max_sum_used_cores" => 0.2}, {"label_name" => "com.redhat.component_different", "label_value" => "EAP7", "container_project_name" => container_project.name, - "hourly_timestamp" => "2012-09-01 01:00:00", + "hourly_timestamp" => Time.parse("2012-09-01 01:00:00 +0000").utc, "max_sum_used_cores" => 1.0}] check_results(results, exp)