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-10-17 18:10:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-17 18:10:37 +0300
commit3884d9d7160e80a70ad327813ada6cab03cded65 (patch)
tree5a827e4b94a90e9fa62417d07db7e434002bcdad /spec/models
parent8060e5c60901ab0f6b890414dccbdf5d1b95c3ad (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/bulk_imports/export_status_spec.rb32
-rw-r--r--spec/models/deployment_spec.rb4
-rw-r--r--spec/models/event_spec.rb29
3 files changed, 26 insertions, 39 deletions
diff --git a/spec/models/bulk_imports/export_status_spec.rb b/spec/models/bulk_imports/export_status_spec.rb
index 606e663e310..0921c3bdce2 100644
--- a/spec/models/bulk_imports/export_status_spec.rb
+++ b/spec/models/bulk_imports/export_status_spec.rb
@@ -157,20 +157,36 @@ RSpec.describe BulkImports::ExportStatus do
end
context 'when something goes wrong during export status fetch' do
- it 'returns exception class as error and memoizes return value' do
+ let(:exception) { BulkImports::NetworkError.new('Error!') }
+
+ before do
allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
- allow(client).to receive(:get).and_raise(StandardError, 'Error!')
+ allow(client).to receive(:get).once.and_raise(exception)
end
+ end
- expect(subject.error).to eq('Error!')
- expect(subject.failed?).to eq(true)
+ it 'raises RetryPipelineError' do
+ allow(exception).to receive(:retriable?).with(tracker).and_return(true)
- allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
- allow(client).to receive(:get).and_return({ 'relation' => relation, 'status' => 'finished' })
+ expect { subject.failed? }.to raise_error(BulkImports::RetryPipelineError)
+ end
+
+ context 'when error is not retriable' do
+ it 'returns exception class as error' do
+ expect(subject.error).to eq('Error!')
+ expect(subject.failed?).to eq(true)
end
+ end
- expect(subject.error).to eq('Error!')
- expect(subject.failed?).to eq(true)
+ context 'when error raised is not a network error' do
+ it 'returns exception class as error' do
+ allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
+ allow(client).to receive(:get).once.and_raise(StandardError, 'Standard Error!')
+ end
+
+ expect(subject.error).to eq('Standard Error!')
+ expect(subject.failed?).to eq(true)
+ end
end
end
end
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index bf1cf9856a0..b91d836f82f 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -28,7 +28,7 @@ RSpec.describe Deployment do
let(:deployment) { create(:deployment) }
it 'delegates to environment_manual_actions' do
- expect(deployment.deployable).to receive(:environment_manual_actions).and_call_original
+ expect(deployment.deployable).to receive(:other_manual_actions).and_call_original
deployment.manual_actions
end
@@ -38,7 +38,7 @@ RSpec.describe Deployment do
let(:deployment) { create(:deployment) }
it 'delegates to environment_scheduled_actions' do
- expect(deployment.deployable).to receive(:environment_scheduled_actions).and_call_original
+ expect(deployment.deployable).to receive(:other_scheduled_actions).and_call_original
deployment.scheduled_actions
end
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb
index 9403eaa1a33..9700852e567 100644
--- a/spec/models/event_spec.rb
+++ b/spec/models/event_spec.rb
@@ -16,35 +16,6 @@ RSpec.describe Event do
it { is_expected.to respond_to(:design_title) }
end
- describe '.first' do
- let(:recorded_query) do
- recorder = ActiveRecord::QueryRecorder.new do
- described_class.first(3)
- end
- recorder.data.each_value.first[:occurrences].first
- end
-
- context 'when skip_default_scope_for_events FF is on' do
- before do
- stub_feature_flags(skip_default_scope_for_events: true)
- end
-
- it 'orders by id' do
- expect(recorded_query).to include('FROM "events" ORDER BY "events"."id" ASC LIMIT 3')
- end
- end
-
- context 'when skip_default_scope_for_events FF is off' do
- before do
- stub_feature_flags(skip_default_scope_for_events: false)
- end
-
- it 'does not have ORDER BY clause' do
- expect(recorded_query).to include('FROM "events" LIMIT 3')
- end
- end
- end
-
describe 'Callbacks' do
let(:project) { create(:project) }