Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb49
1 files changed, 14 insertions, 35 deletions
diff --git a/spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb
index 481e11bcf0e..d4802a19202 100644
--- a/spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb
+++ b/spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb
@@ -1,38 +1,5 @@
# frozen_string_literal: true
-RSpec.shared_examples 'a daily tracked issuable event' do
- before do
- stub_application_setting(usage_ping_enabled: true)
- end
-
- def count_unique(date_from: 1.minute.ago, date_to: 1.minute.from_now)
- Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: action, start_date: date_from, end_date: date_to)
- end
-
- specify do
- aggregate_failures do
- expect(track_action(author: user1)).to be_truthy
- expect(track_action(author: user1)).to be_truthy
- expect(track_action(author: user2)).to be_truthy
- expect(count_unique).to eq(2)
- end
- end
-
- it 'does not track edit actions if author is not present' do
- expect(track_action(author: nil)).to be_nil
- end
-end
-
-RSpec.shared_examples 'does not track when feature flag is disabled' do |feature_flag|
- context "when feature flag #{feature_flag} is disabled" do
- it 'does not track action' do
- stub_feature_flags(feature_flag => false)
-
- expect(track_action(author: user1)).to be_nil
- end
- end
-end
-
RSpec.shared_examples 'a daily tracked issuable snowplow and service ping events for given event params' do
before do
stub_application_setting(usage_ping_enabled: true)
@@ -76,15 +43,27 @@ end
RSpec.shared_examples 'daily tracked issuable snowplow and service ping events with project' do
it_behaves_like 'a daily tracked issuable snowplow and service ping events for given event params' do
+ let(:context) do
+ Gitlab::Tracking::ServicePingContext
+ .new(data_source: :redis_hll, event: event_property)
+ .to_h
+ end
+
let(:track_params) { { project: project } }
- let(:event_params) { track_params.merge(label: event_label, property: event_property, namespace: project.namespace) }
+ let(:event_params) { track_params.merge(label: event_label, property: event_property, namespace: project.namespace, context: [context]) }
end
end
RSpec.shared_examples 'a daily tracked issuable snowplow and service ping events with namespace' do
it_behaves_like 'a daily tracked issuable snowplow and service ping events for given event params' do
+ let(:context) do
+ Gitlab::Tracking::ServicePingContext
+ .new(data_source: :redis_hll, event: event_property)
+ .to_h
+ end
+
let(:track_params) { { namespace: namespace } }
- let(:event_params) { track_params.merge(label: event_label, property: event_property) }
+ let(:event_params) { track_params.merge(label: event_label, property: event_property, context: [context]) }
end
end