diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-15 06:11:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-15 06:11:37 +0300 |
commit | aa9f2954530d4b43a4e3b190b7769fe5b6b6a64e (patch) | |
tree | 4f6f50b00030f7edc01a7ad23f5744a1abcde0aa /spec/lib/gitlab/usage_data_spec.rb | |
parent | 38b948a54e00841b51c446beb0adf079af60c963 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/usage_data_spec.rb')
-rw-r--r-- | spec/lib/gitlab/usage_data_spec.rb | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index 5fbc807fa6d..d8f50fa27bb 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -1178,110 +1178,6 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do end end - describe '.email_campaign_counts' do - subject { described_class.send(:email_campaign_counts) } - - context 'when queries time out' do - before do - allow_any_instance_of(ActiveRecord::Relation).to receive(:count).and_raise(ActiveRecord::StatementInvalid) - allow(Gitlab::ErrorTracking).to receive(:should_raise_for_dev?).and_return(should_raise_for_dev) - end - - context 'with should_raise_for_dev? true' do - let(:should_raise_for_dev) { true } - - it 'raises an error' do - expect { subject }.to raise_error(ActiveRecord::StatementInvalid) - end - end - - context 'with should_raise_for_dev? false' do - let(:should_raise_for_dev) { false } - - it 'returns -1 for email campaign data' do - expected_data = { - "in_product_marketing_email_create_0_sent" => -1, - "in_product_marketing_email_create_0_cta_clicked" => -1, - "in_product_marketing_email_create_1_sent" => -1, - "in_product_marketing_email_create_1_cta_clicked" => -1, - "in_product_marketing_email_create_2_sent" => -1, - "in_product_marketing_email_create_2_cta_clicked" => -1, - "in_product_marketing_email_team_short_0_sent" => -1, - "in_product_marketing_email_team_short_0_cta_clicked" => -1, - "in_product_marketing_email_trial_short_0_sent" => -1, - "in_product_marketing_email_trial_short_0_cta_clicked" => -1, - "in_product_marketing_email_admin_verify_0_sent" => -1, - "in_product_marketing_email_admin_verify_0_cta_clicked" => -1, - "in_product_marketing_email_verify_0_sent" => -1, - "in_product_marketing_email_verify_0_cta_clicked" => -1, - "in_product_marketing_email_verify_1_sent" => -1, - "in_product_marketing_email_verify_1_cta_clicked" => -1, - "in_product_marketing_email_verify_2_sent" => -1, - "in_product_marketing_email_verify_2_cta_clicked" => -1, - "in_product_marketing_email_trial_0_sent" => -1, - "in_product_marketing_email_trial_0_cta_clicked" => -1, - "in_product_marketing_email_trial_1_sent" => -1, - "in_product_marketing_email_trial_1_cta_clicked" => -1, - "in_product_marketing_email_trial_2_sent" => -1, - "in_product_marketing_email_trial_2_cta_clicked" => -1, - "in_product_marketing_email_team_0_sent" => -1, - "in_product_marketing_email_team_0_cta_clicked" => -1, - "in_product_marketing_email_team_1_sent" => -1, - "in_product_marketing_email_team_1_cta_clicked" => -1, - "in_product_marketing_email_team_2_sent" => -1, - "in_product_marketing_email_team_2_cta_clicked" => -1 - } - - expect(subject).to eq(expected_data) - end - end - end - - context 'when there are entries' do - before do - create(:in_product_marketing_email, track: :create, series: 0, cta_clicked_at: Time.zone.now) - create(:in_product_marketing_email, track: :verify, series: 0) - end - - it 'gathers email campaign data' do - expected_data = { - "in_product_marketing_email_create_0_sent" => 1, - "in_product_marketing_email_create_0_cta_clicked" => 1, - "in_product_marketing_email_create_1_sent" => 0, - "in_product_marketing_email_create_1_cta_clicked" => 0, - "in_product_marketing_email_create_2_sent" => 0, - "in_product_marketing_email_create_2_cta_clicked" => 0, - "in_product_marketing_email_team_short_0_sent" => 0, - "in_product_marketing_email_team_short_0_cta_clicked" => 0, - "in_product_marketing_email_trial_short_0_sent" => 0, - "in_product_marketing_email_trial_short_0_cta_clicked" => 0, - "in_product_marketing_email_admin_verify_0_sent" => 0, - "in_product_marketing_email_admin_verify_0_cta_clicked" => 0, - "in_product_marketing_email_verify_0_sent" => 1, - "in_product_marketing_email_verify_0_cta_clicked" => 0, - "in_product_marketing_email_verify_1_sent" => 0, - "in_product_marketing_email_verify_1_cta_clicked" => 0, - "in_product_marketing_email_verify_2_sent" => 0, - "in_product_marketing_email_verify_2_cta_clicked" => 0, - "in_product_marketing_email_trial_0_sent" => 0, - "in_product_marketing_email_trial_0_cta_clicked" => 0, - "in_product_marketing_email_trial_1_sent" => 0, - "in_product_marketing_email_trial_1_cta_clicked" => 0, - "in_product_marketing_email_trial_2_sent" => 0, - "in_product_marketing_email_trial_2_cta_clicked" => 0, - "in_product_marketing_email_team_0_sent" => 0, - "in_product_marketing_email_team_0_cta_clicked" => 0, - "in_product_marketing_email_team_1_sent" => 0, - "in_product_marketing_email_team_1_cta_clicked" => 0, - "in_product_marketing_email_team_2_sent" => 0, - "in_product_marketing_email_team_2_cta_clicked" => 0 - } - - expect(subject).to eq(expected_data) - end - end - end - describe ".with_duration" do it 'records duration' do expect(::Gitlab::Usage::ServicePing::LegacyMetricTimingDecorator) |