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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-25 12:08:47 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-25 12:08:47 +0300
commitf71f0f5307d836c4b0a7e501e4af799a536f3454 (patch)
tree96a16aeb2ece04f78aa95e84c8fd9da973824a5d /spec
parente83b20c4f32415ecc6c76a33d6259bfca13ec250 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/commands/sidekiq_cluster/cli_spec.rb10
-rw-r--r--spec/controllers/application_controller_spec.rb4
-rw-r--r--spec/controllers/oauth/authorizations_controller_spec.rb18
-rw-r--r--spec/frontend/editor/helpers.js6
-rw-r--r--spec/frontend/editor/source_editor_extension_spec.js1
-rw-r--r--spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js42
-rw-r--r--spec/workers/every_sidekiq_worker_spec.rb2
-rw-r--r--spec/workers/expire_job_cache_worker_spec.rb31
-rw-r--r--spec/workers/expire_pipeline_cache_worker_spec.rb38
9 files changed, 71 insertions, 81 deletions
diff --git a/spec/commands/sidekiq_cluster/cli_spec.rb b/spec/commands/sidekiq_cluster/cli_spec.rb
index 223d0c3b0ec..3bc3b93c250 100644
--- a/spec/commands/sidekiq_cluster/cli_spec.rb
+++ b/spec/commands/sidekiq_cluster/cli_spec.rb
@@ -195,22 +195,22 @@ RSpec.describe Gitlab::SidekiqCluster::CLI, stub_settings_source: true do # rubo
},
'high urgency CI queues' => {
query: 'feature_category=continuous_integration&urgency=high',
- included_queues: %w(pipeline_cache:expire_job_cache pipeline_cache:expire_pipeline_cache),
+ included_queues: %w(pipeline_default:ci_drop_pipeline),
excluded_queues: %w(merge)
},
'CPU-bound high urgency CI queues' => {
query: 'feature_category=continuous_integration&urgency=high&resource_boundary=cpu',
- included_queues: %w(pipeline_cache:expire_pipeline_cache),
- excluded_queues: %w(pipeline_cache:expire_job_cache merge)
+ included_queues: %w(pipeline_default:ci_create_downstream_pipeline),
+ excluded_queues: %w(pipeline_default:ci_drop_pipeline merge)
},
'CPU-bound high urgency non-CI queues' => {
query: 'feature_category!=continuous_integration&urgency=high&resource_boundary=cpu',
included_queues: %w(new_issue),
- excluded_queues: %w(pipeline_cache:expire_pipeline_cache)
+ excluded_queues: %w(pipeline_default:ci_create_downstream_pipeline)
},
'CI and SCM queues' => {
query: 'feature_category=continuous_integration|feature_category=source_code_management',
- included_queues: %w(pipeline_cache:expire_job_cache merge),
+ included_queues: %w(pipeline_default:ci_drop_pipeline merge),
excluded_queues: %w(mailers)
}
}
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index ddd80b67639..c5306fda0a5 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -105,10 +105,6 @@ RSpec.describe ApplicationController do
describe 'session expiration' do
controller(described_class) do
- # The anonymous controller will report 401 and fail to run any actions.
- # Normally, GitLab will just redirect you to sign in.
- skip_before_action :authenticate_user!, only: :index
-
def index
render html: 'authenticated'
end
diff --git a/spec/controllers/oauth/authorizations_controller_spec.rb b/spec/controllers/oauth/authorizations_controller_spec.rb
index 7489f506674..fb90a70d91d 100644
--- a/spec/controllers/oauth/authorizations_controller_spec.rb
+++ b/spec/controllers/oauth/authorizations_controller_spec.rb
@@ -195,6 +195,24 @@ RSpec.describe Oauth::AuthorizationsController do
end
end
end
+
+ context 'when the user is not signed in' do
+ before do
+ sign_out(user)
+ end
+
+ it 'sets a lower session expiry and redirects to the sign in page' do
+ subject
+
+ expect(request.env['rack.session.options'][:expire_after]).to eq(
+ Settings.gitlab['unauthenticated_session_expire_delay']
+ )
+
+ expect(request.session['user_return_to']).to eq("/oauth/authorize?#{params.to_query}")
+ expect(response).to have_gitlab_http_status(:found)
+ expect(response).to redirect_to(new_user_session_path)
+ end
+ end
end
describe 'POST #create' do
diff --git a/spec/frontend/editor/helpers.js b/spec/frontend/editor/helpers.js
index 252d783ad6d..48d83a87a6e 100644
--- a/spec/frontend/editor/helpers.js
+++ b/spec/frontend/editor/helpers.js
@@ -49,6 +49,12 @@ export const SEConstExt = () => {
};
};
+export const SEExtWithoutAPI = () => {
+ return {
+ extensionName: 'SEExtWithoutAPI',
+ };
+};
+
export class SEWithSetupExt {
static get extensionName() {
return 'SEWithSetupExt';
diff --git a/spec/frontend/editor/source_editor_extension_spec.js b/spec/frontend/editor/source_editor_extension_spec.js
index c5fa795f3b7..78453aaa491 100644
--- a/spec/frontend/editor/source_editor_extension_spec.js
+++ b/spec/frontend/editor/source_editor_extension_spec.js
@@ -54,6 +54,7 @@ describe('Editor Extension', () => {
${helpers.SEClassExtension} | ${['shared', 'classExtMethod']}
${helpers.SEFnExtension} | ${['fnExtMethod']}
${helpers.SEConstExt} | ${['constExtMethod']}
+ ${helpers.SEExtWithoutAPI} | ${[]}
`('correctly returns API for $definition', ({ definition, expectedKeys }) => {
const extension = new EditorExtension({ definition });
const expectedApi = Object.fromEntries(
diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
index da3a323e8ea..46d90ddc83c 100644
--- a/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
+++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
@@ -87,7 +87,11 @@ const createReadyToMergeResponse = (customMr) => {
});
};
-const createComponent = (customConfig = {}, mergeRequestWidgetGraphql = false) => {
+const createComponent = (
+ customConfig = {},
+ mergeRequestWidgetGraphql = false,
+ restructuredMrWidget = false,
+) => {
wrapper = shallowMount(ReadyToMerge, {
localVue,
propsData: {
@@ -97,6 +101,7 @@ const createComponent = (customConfig = {}, mergeRequestWidgetGraphql = false) =
provide: {
glFeatures: {
mergeRequestWidgetGraphql,
+ restructuredMrWidget,
},
},
stubs: {
@@ -307,6 +312,20 @@ describe('ReadyToMerge', () => {
},
});
+ beforeEach(() => {
+ readyToMergeResponseSpy = jest
+ .fn()
+ .mockResolvedValueOnce(createReadyToMergeResponse({ squash: true, squashOnMerge: true }))
+ .mockResolvedValue(
+ createReadyToMergeResponse({
+ squash: true,
+ squashOnMerge: true,
+ defaultMergeCommitMessage: '',
+ defaultSquashCommitMessage: '',
+ }),
+ );
+ });
+
it('should handle merge when pipeline succeeds', async () => {
createComponent();
@@ -379,6 +398,27 @@ describe('ReadyToMerge', () => {
expect(params.should_remove_source_branch).toBeTruthy();
expect(params.auto_merge_strategy).toBeUndefined();
});
+
+ it('hides edit commit message', async () => {
+ createComponent({}, true, true);
+
+ await waitForPromises();
+
+ jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
+ jest.spyOn(wrapper.vm.service, 'merge').mockResolvedValue(response('success'));
+
+ await wrapper
+ .findComponent('[data-testid="widget_edit_commit_message"]')
+ .vm.$emit('input', true);
+
+ expect(wrapper.findComponent('[data-testid="edit_commit_message"]').exists()).toBe(true);
+
+ wrapper.vm.handleMergeButtonClick();
+
+ await waitForPromises();
+
+ expect(wrapper.findComponent('[data-testid="edit_commit_message"]').exists()).toBe(false);
+ });
});
describe('initiateRemoveSourceBranchPolling', () => {
diff --git a/spec/workers/every_sidekiq_worker_spec.rb b/spec/workers/every_sidekiq_worker_spec.rb
index 8b5f850d8de..625b4644649 100644
--- a/spec/workers/every_sidekiq_worker_spec.rb
+++ b/spec/workers/every_sidekiq_worker_spec.rb
@@ -227,8 +227,6 @@ RSpec.describe 'Every Sidekiq worker' do
'Epics::UpdateEpicsDatesWorker' => 3,
'ErrorTrackingIssueLinkWorker' => 3,
'Experiments::RecordConversionEventWorker' => 3,
- 'ExpireJobCacheWorker' => 3,
- 'ExpirePipelineCacheWorker' => 3,
'ExportCsvWorker' => 3,
'ExternalServiceReactiveCachingWorker' => 3,
'FileHookWorker' => false,
diff --git a/spec/workers/expire_job_cache_worker_spec.rb b/spec/workers/expire_job_cache_worker_spec.rb
deleted file mode 100644
index e9af39ed2df..00000000000
--- a/spec/workers/expire_job_cache_worker_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe ExpireJobCacheWorker do
- let_it_be(:pipeline) { create(:ci_empty_pipeline) }
-
- let(:project) { pipeline.project }
-
- describe '#perform' do
- context 'with a job in the pipeline' do
- let_it_be(:job) { create(:ci_build, pipeline: pipeline) }
-
- let(:job_args) { job.id }
-
- it_behaves_like 'an idempotent worker'
-
- it_behaves_like 'worker with data consistency',
- described_class,
- data_consistency: :delayed
- end
-
- context 'when there is no job in the pipeline' do
- it 'does not change the etag store' do
- expect(Gitlab::EtagCaching::Store).not_to receive(:new)
-
- perform_multiple(non_existing_record_id)
- end
- end
- end
-end
diff --git a/spec/workers/expire_pipeline_cache_worker_spec.rb b/spec/workers/expire_pipeline_cache_worker_spec.rb
deleted file mode 100644
index f4c4df2e752..00000000000
--- a/spec/workers/expire_pipeline_cache_worker_spec.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe ExpirePipelineCacheWorker do
- let_it_be(:user) { create(:user) }
- let_it_be(:project) { create(:project) }
- let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
-
- subject { described_class.new }
-
- describe '#perform' do
- it 'executes the service' do
- expect_next_instance_of(Ci::ExpirePipelineCacheService) do |instance|
- expect(instance).to receive(:execute).with(pipeline).and_call_original
- end
-
- subject.perform(pipeline.id)
- end
-
- it "doesn't do anything if the pipeline not exist" do
- expect_any_instance_of(Ci::ExpirePipelineCacheService).not_to receive(:execute)
- expect_any_instance_of(Gitlab::EtagCaching::Store).not_to receive(:touch)
-
- subject.perform(617748)
- end
-
- skip "with https://gitlab.com/gitlab-org/gitlab/-/issues/325291 resolved" do
- it_behaves_like 'an idempotent worker' do
- let(:job_args) { [pipeline.id] }
- end
- end
-
- it_behaves_like 'worker with data consistency',
- described_class,
- data_consistency: :delayed
- end
-end