Commit a6b2387d authored by Shinya Maeda's avatar Shinya Maeda

Collect usage pings `Gcp::Cluster.enabled` and `Gcp::Cluster.disabled`,...

Collect usage pings `Gcp::Cluster.enabled` and `Gcp::Cluster.disabled`, instead of `Gcp::Cluster.count`
parent 5a2acfe0
......@@ -7,6 +7,9 @@ module Gcp
belongs_to :user
belongs_to :service
scope :enabled, -> { where(enabled: true) }
scope :disabled, -> { where(enabled: false) }
default_value_for :gcp_cluster_zone, 'us-central1-a'
default_value_for :gcp_cluster_size, 3
default_value_for :gcp_machine_type, 'n1-standard-4'
......
......@@ -49,6 +49,8 @@ module Gitlab
deployments: Deployment.count,
environments: ::Environment.count,
gcp_clusters: ::Gcp::Cluster.count,
gcp_clusters_enabled: ::Gcp::Cluster.enabled.count,
gcp_clusters_disabled: ::Gcp::Cluster.disabled.count,
in_review_folder: ::Environment.in_review_folder.count,
groups: Group.count,
issues: Issue.count,
......
......@@ -61,6 +61,8 @@ describe Gitlab::UsageData do
deployments
environments
gcp_clusters
gcp_clusters_enabled
gcp_clusters_disabled
in_review_folder
groups
issues
......
......@@ -7,6 +7,30 @@ describe Gcp::Cluster do
it { is_expected.to validate_presence_of(:gcp_cluster_zone) }
describe '.enabled' do
subject { described_class.enabled }
let!(:cluster) { create(:gcp_cluster, enabled: true) }
before do
create(:gcp_cluster, enabled: false)
end
it { is_expected.to contain_exactly(cluster) }
end
describe '.disabled' do
subject { described_class.disabled }
let!(:cluster) { create(:gcp_cluster, enabled: false) }
before do
create(:gcp_cluster, enabled: true)
end
it { is_expected.to contain_exactly(cluster) }
end
describe '#default_value_for' do
let(:cluster) { described_class.new }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment