Skip to content

Commit

Permalink
Merge pull request ManageIQ#7705 from yaacov/chanfe-containergroup-to…
Browse files Browse the repository at this point in the history
…-container-group

change containergroup to container group
  • Loading branch information
chessbyte committed Apr 5, 2016
2 parents 633b63c + c717602 commit 74e99a3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/models/metric/rollup.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions app/models/metric/statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions spec/models/metric/statistic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 74e99a3

Please sign in to comment.