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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 11:17:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 11:17:02 +0300
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /spec/support/shared_examples/lib/gitlab
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/support/shared_examples/lib/gitlab')
-rw-r--r--spec/support/shared_examples/lib/gitlab/config/inheritable_shared_examples.rb5
-rw-r--r--spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb41
2 files changed, 36 insertions, 10 deletions
diff --git a/spec/support/shared_examples/lib/gitlab/config/inheritable_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/config/inheritable_shared_examples.rb
index 95772b1774a..5eae8777a20 100644
--- a/spec/support/shared_examples/lib/gitlab/config/inheritable_shared_examples.rb
+++ b/spec/support/shared_examples/lib/gitlab/config/inheritable_shared_examples.rb
@@ -86,7 +86,10 @@ RSpec.shared_examples 'with inheritable CI config' do
expect do
# we ignore exceptions as `#overwrite_entry`
# can raise exception on duplicates
- entry.send(:inherit!, deps) rescue described_class::InheritError
+
+ entry.send(:inherit!, deps)
+ rescue described_class::InheritError
+ nil
end.not_to change { entry[entry_key] }
end
end
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 9d280d9404a..481e11bcf0e 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
@@ -33,7 +33,7 @@ RSpec.shared_examples 'does not track when feature flag is disabled' do |feature
end
end
-RSpec.shared_examples 'a daily tracked issuable snowplow and service ping events' do
+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)
end
@@ -44,22 +44,21 @@ RSpec.shared_examples 'a daily tracked issuable snowplow and service ping events
specify do
aggregate_failures do
- expect(track_action(author: user1, project: project)).to be_truthy
- expect(track_action(author: user1, project: project)).to be_truthy
- expect(track_action(author: user2, project: project)).to be_truthy
+ expect(track_action({ author: user1 }.merge(track_params))).to be_truthy
+ expect(track_action({ author: user1 }.merge(track_params))).to be_truthy
+ expect(track_action({ author: user2 }.merge(track_params))).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, project: project)).to be_nil
+ expect(track_action({ author: nil }.merge(track_params))).to be_nil
end
it 'emits snowplow event' do
- track_action(author: user1, project: project)
+ track_action({ author: user1 }.merge(track_params))
- expect_snowplow_event(category: 'issues_edit', action: action, user: user1,
- namespace: project.namespace, project: project)
+ expect_snowplow_event(**{ category: category, action: event_action, user: user1 }.merge(event_params))
end
context 'with route_hll_to_snowplow_phase2 disabled' do
@@ -68,9 +67,33 @@ RSpec.shared_examples 'a daily tracked issuable snowplow and service ping events
end
it 'does not emit snowplow event' do
- track_action(author: user1, project: project)
+ track_action({ author: user1 }.merge(track_params))
expect_no_snowplow_event
end
end
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(:track_params) { { project: project } }
+ let(:event_params) { track_params.merge(label: event_label, property: event_property, namespace: project.namespace) }
+ 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(:track_params) { { namespace: namespace } }
+ let(:event_params) { track_params.merge(label: event_label, property: event_property) }
+ end
+end
+
+RSpec.shared_examples 'does not track with namespace 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, namespace: namespace)).to be_nil
+ end
+ end
+end