diff options
author | Alex Kalderimis <akalderimis@gitlab.com> | 2019-07-21 01:26:19 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-07-21 01:26:19 +0000 |
commit | 7320758611b8d8c28fb179f970e015a72357b94d (patch) | |
tree | c74e9e90c6f0fd35f5b3cf08466c2947b39128ca /spec/lib/gitlab/usage_data_spec.rb | |
parent | 66394bd1b7c98d7a6abbeade068b8b9c1b838ddf (diff) | |
download | gitlab-ce-7320758611b8d8c28fb179f970e015a72357b94d.tar.gz |
Count wiki page creation
This adds a counter to count page creation, which is reflected in the
usage-data we collect.
The number created is stored in Redis, avoiding DB access.
Diffstat (limited to 'spec/lib/gitlab/usage_data_spec.rb')
-rw-r--r-- | spec/lib/gitlab/usage_data_spec.rb | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index 270dd652c20..2289d906944 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -57,20 +57,18 @@ describe Gitlab::UsageData do gitaly database avg_cycle_analytics - web_ide_views - web_ide_commits - web_ide_merge_requests influxdb_metrics_enabled prometheus_metrics_enabled )) - end - - it 'calls expected usage data methods' do - expect(Gitlab::UsageDataCounters::WebIdeCounter).to receive(:total_commits_count) - expect(Gitlab::UsageDataCounters::WebIdeCounter).to receive(:total_merge_requests_count) - expect(Gitlab::UsageDataCounters::WebIdeCounter).to receive(:total_views_count) - subject + expect(subject).to include( + wiki_pages_create: a_kind_of(Integer), + wiki_pages_update: a_kind_of(Integer), + wiki_pages_delete: a_kind_of(Integer), + web_ide_views: a_kind_of(Integer), + web_ide_commits: a_kind_of(Integer), + web_ide_merge_requests: a_kind_of(Integer) + ) end it "gathers usage counts" do @@ -192,6 +190,28 @@ describe Gitlab::UsageData do end end + describe '#usage_data_counters' do + subject { described_class.usage_data_counters } + + it { is_expected.to all(respond_to :totals) } + + describe 'the results of calling #totals on all objects in the array' do + subject { described_class.usage_data_counters.map(&:totals) } + + it do + is_expected + .to all(be_a Hash) + .and all(have_attributes(keys: all(be_a Symbol), values: all(be_a Integer))) + end + end + + it 'does not have any conflicts' do + all_keys = subject.flat_map { |counter| counter.totals.keys } + + expect(all_keys.size).to eq all_keys.to_set.size + end + end + describe '#features_usage_data_ce' do subject { described_class.features_usage_data_ce } |