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-09 15:11:57 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-09 15:11:57 +0300
commit1f229cdc22b5b32989bcff2037d8925c75703671 (patch)
treec92e9dff7737e78d7331518cdf69f90403af09ea /spec/models
parent7a98d989740ec85982cdb6c1d57c8f24270e455e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/concerns/bulk_insert_safe_spec.rb4
-rw-r--r--spec/models/design_management/version_spec.rb8
-rw-r--r--spec/models/group_spec.rb12
-rw-r--r--spec/models/integrations/slack_spec.rb17
-rw-r--r--spec/models/namespace/traversal_hierarchy_spec.rb6
5 files changed, 38 insertions, 9 deletions
diff --git a/spec/models/concerns/bulk_insert_safe_spec.rb b/spec/models/concerns/bulk_insert_safe_spec.rb
index e6b197f34ca..569dc3a3a3e 100644
--- a/spec/models/concerns/bulk_insert_safe_spec.rb
+++ b/spec/models/concerns/bulk_insert_safe_spec.rb
@@ -170,7 +170,9 @@ RSpec.describe BulkInsertSafe do
all_items = bulk_insert_item_class.valid_list(10) + bulk_insert_item_class.invalid_list(10)
expect do
- bulk_insert_item_class.bulk_insert!(all_items, batch_size: 2) rescue nil
+ bulk_insert_item_class.bulk_insert!(all_items, batch_size: 2)
+ rescue StandardError
+ nil
end.not_to change { bulk_insert_item_class.count }
end
diff --git a/spec/models/design_management/version_spec.rb b/spec/models/design_management/version_spec.rb
index 303bac61e1e..519ba3c67b4 100644
--- a/spec/models/design_management/version_spec.rb
+++ b/spec/models/design_management/version_spec.rb
@@ -142,14 +142,18 @@ RSpec.describe DesignManagement::Version do
it 'does not leave invalid versions around if creation fails' do
expect do
- described_class.create_for_designs([], 'abcdef', author) rescue nil
+ described_class.create_for_designs([], 'abcdef', author)
+ rescue StandardError
+ nil
end.not_to change { described_class.count }
end
it 'does not leave orphaned design-versions around if creation fails' do
actions = as_actions(designs)
expect do
- described_class.create_for_designs(actions, '', author) rescue nil
+ described_class.create_for_designs(actions, '', author)
+ rescue StandardError
+ nil
end.not_to change { DesignManagement::Action.count }
end
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index 5b0466c46a2..5e4685ac148 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -2603,7 +2603,11 @@ RSpec.describe Group do
it 'does not enable shared runners' do
expect do
- subject rescue nil
+ begin
+ subject
+ rescue StandardError
+ nil
+ end
parent.reload
group.reload
@@ -2704,7 +2708,11 @@ RSpec.describe Group do
it 'does not allow descendants to override' do
expect do
- subject rescue nil
+ begin
+ subject
+ rescue StandardError
+ nil
+ end
parent.reload
group.reload
diff --git a/spec/models/integrations/slack_spec.rb b/spec/models/integrations/slack_spec.rb
index 5801a4c3749..ed282f1d39d 100644
--- a/spec/models/integrations/slack_spec.rb
+++ b/spec/models/integrations/slack_spec.rb
@@ -6,7 +6,8 @@ RSpec.describe Integrations::Slack do
it_behaves_like Integrations::SlackMattermostNotifier, "Slack"
describe '#execute' do
- let_it_be(:slack_integration) { create(:integrations_slack, branches_to_be_notified: 'all') }
+ let(:slack_integration) { create(:integrations_slack, branches_to_be_notified: 'all', project_id: project.id) }
+ let(:project) { create_default(:project, :repository, :wiki_repo) }
before do
stub_request(:post, slack_integration.webhook)
@@ -20,13 +21,23 @@ RSpec.describe Integrations::Slack do
context 'hook data includes a user object' do
let_it_be(:user) { create_default(:user) }
- let_it_be(:project) { create_default(:project, :repository, :wiki_repo) }
shared_examples 'increases the usage data counter' do |event_name|
+ subject(:execute) { slack_integration.execute(data) }
+
it 'increases the usage data counter' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event).with(event_name, values: user.id).and_call_original
- slack_integration.execute(data)
+ execute
+ end
+
+ it_behaves_like 'Snowplow event tracking' do
+ let(:feature_flag_name) { :route_hll_to_snowplow_phase2 }
+ let(:category) { 'Integrations::Slack' }
+ let(:action) { 'perform_integrations_action' }
+ let(:namespace) { project.namespace }
+ let(:label) { 'redis_hll_counters.ecosystem.ecosystem_total_unique_counts_monthly' }
+ let(:property) { event_name }
end
end
diff --git a/spec/models/namespace/traversal_hierarchy_spec.rb b/spec/models/namespace/traversal_hierarchy_spec.rb
index 51932ab943c..918ff6aa154 100644
--- a/spec/models/namespace/traversal_hierarchy_spec.rb
+++ b/spec/models/namespace/traversal_hierarchy_spec.rb
@@ -85,7 +85,11 @@ RSpec.describe Namespace::TraversalHierarchy, type: :model do
it { expect { subject }.to raise_error(ActiveRecord::Deadlocked) }
it 'increment db_deadlock counter' do
- expect { subject rescue nil }.to change { db_deadlock_total('Namespace#sync_traversal_ids!') }.by(1)
+ expect do
+ subject
+ rescue StandardError
+ nil
+ end.to change { db_deadlock_total('Namespace#sync_traversal_ids!') }.by(1)
end
end
end