Commit 07623179 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch...

Merge branch 'fix/sm/38960-collect-usage-pings-gcp-cluster-enabled-and-gcp-cluster-disabled-instead-of-gcp-cluster-count' into 'master'

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

Closes #38960

See merge request gitlab-org/gitlab-ce!14807
parents 7a8b97e1 a6b2387d
...@@ -7,6 +7,9 @@ module Gcp ...@@ -7,6 +7,9 @@ module Gcp
belongs_to :user belongs_to :user
belongs_to :service 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_zone, 'us-central1-a'
default_value_for :gcp_cluster_size, 3 default_value_for :gcp_cluster_size, 3
default_value_for :gcp_machine_type, 'n1-standard-4' default_value_for :gcp_machine_type, 'n1-standard-4'
......
...@@ -49,6 +49,8 @@ module Gitlab ...@@ -49,6 +49,8 @@ module Gitlab
deployments: Deployment.count, deployments: Deployment.count,
environments: ::Environment.count, environments: ::Environment.count,
gcp_clusters: ::Gcp::Cluster.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, in_review_folder: ::Environment.in_review_folder.count,
groups: Group.count, groups: Group.count,
issues: Issue.count, issues: Issue.count,
......
...@@ -61,6 +61,8 @@ describe Gitlab::UsageData do ...@@ -61,6 +61,8 @@ describe Gitlab::UsageData do
deployments deployments
environments environments
gcp_clusters gcp_clusters
gcp_clusters_enabled
gcp_clusters_disabled
in_review_folder in_review_folder
groups groups
issues issues
......
...@@ -7,6 +7,30 @@ describe Gcp::Cluster do ...@@ -7,6 +7,30 @@ describe Gcp::Cluster do
it { is_expected.to validate_presence_of(:gcp_cluster_zone) } 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 describe '#default_value_for' do
let(:cluster) { described_class.new } 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