From c71760259091238bfcfdceccb951e1104153cdf3 Mon Sep 17 00:00:00 2001 From: Yaacov Zamir Date: Tue, 5 Apr 2016 10:50:10 +0300 Subject: [PATCH] change containergroup to container group --- app/models/metric/rollup.rb | 2 +- app/models/metric/statistic.rb | 4 ++-- ...160405074214_change_container_group_metric_field_name.rb | 6 ++++++ spec/models/metric/statistic_spec.rb | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20160405074214_change_container_group_metric_field_name.rb diff --git a/app/models/metric/rollup.rb b/app/models/metric/rollup.rb index c06ee18b0df..280e7edae20 100644 --- a/app/models/metric/rollup.rb +++ b/app/models/metric/rollup.rb @@ -1,6 +1,6 @@ module Metric::Rollup ROLLUP_COLS = Metric.columns_hash.collect { |c, h| c.to_sym if h.type == :float || c[0, 7] == "derived" }.compact + - [:stat_containergroup_create_rate, :stat_containergroup_delete_rate] + [:stat_container_group_create_rate, :stat_container_group_delete_rate] STORAGE_COLS = Metric.columns_hash.collect { |c, _h| c.to_sym if c.starts_with?("derived_storage_") }.compact NON_STORAGE_ROLLUP_COLS = (ROLLUP_COLS - STORAGE_COLS) diff --git a/app/models/metric/statistic.rb b/app/models/metric/statistic.rb index 3a0798d6122..3c64127e6b7 100644 --- a/app/models/metric/statistic.rb +++ b/app/models/metric/statistic.rb @@ -6,8 +6,8 @@ def self.calculate_stat_columns(obj, timestamp) container_groups = ContainerGroup.where(:ems_id => obj.id).or(ContainerGroup.where(:old_ems_id => obj.id)) { - :stat_containergroup_create_rate => container_groups.where(:created_on => capture_interval).count, - :stat_containergroup_delete_rate => container_groups.where(:deleted_on => capture_interval).count + :stat_container_group_create_rate => container_groups.where(:created_on => capture_interval).count, + :stat_container_group_delete_rate => container_groups.where(:deleted_on => capture_interval).count } end end diff --git a/db/migrate/20160405074214_change_container_group_metric_field_name.rb b/db/migrate/20160405074214_change_container_group_metric_field_name.rb new file mode 100644 index 00000000000..5aaf34daecf --- /dev/null +++ b/db/migrate/20160405074214_change_container_group_metric_field_name.rb @@ -0,0 +1,6 @@ +class ChangeContainerGroupMetricFieldName < ActiveRecord::Migration[5.0] + def change + rename_column :metric_rollups, :stat_containergroup_create_rate, :stat_container_group_create_rate + rename_column :metric_rollups, :stat_containergroup_delete_rate, :stat_container_group_delete_rate + end +end diff --git a/spec/models/metric/statistic_spec.rb b/spec/models/metric/statistic_spec.rb index 071254f7d69..cc43e0d631e 100644 --- a/spec/models/metric/statistic_spec.rb +++ b/spec/models/metric/statistic_spec.rb @@ -21,14 +21,14 @@ ems_openshift.container_groups << [c1, c2, c3, c4, c5, c6, c7, c8] derived_columns = described_class.calculate_stat_columns(ems_openshift, hour) - expect(derived_columns[:stat_containergroup_create_rate]).to eq(2) + expect(derived_columns[:stat_container_group_create_rate]).to eq(2) end it "count deleted container groups in a provider" do ems_openshift.container_groups << [c1, c2, c3, c4, c5, c6, c7, c8] derived_columns = described_class.calculate_stat_columns(ems_openshift, hour) - expect(derived_columns[:stat_containergroup_delete_rate]).to eq(2) + expect(derived_columns[:stat_container_group_delete_rate]).to eq(2) end end end