diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-20 18:08:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-20 18:08:44 +0000 |
commit | e0ab7eda1b1013e3246b0db28689b0749158f0bf (patch) | |
tree | c0b4fa77a0a781f0e0e868133293053ae75c2aff /spec | |
parent | 364f6f2e33e6f5eafe63b25d9256b88e72141b1c (diff) | |
download | gitlab-ce-e0ab7eda1b1013e3246b0db28689b0749158f0bf.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
6 files changed, 111 insertions, 5 deletions
diff --git a/spec/features/merge_request/user_posts_diff_notes_spec.rb b/spec/features/merge_request/user_posts_diff_notes_spec.rb index 8b16760606c..a76e40da9e5 100644 --- a/spec/features/merge_request/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_request/user_posts_diff_notes_spec.rb @@ -56,7 +56,7 @@ describe 'Merge request > User posts diff notes', :js do end context 'with an unchanged line on the left and an unchanged line on the right' do - it 'allows commenting on the left side' do + it 'allows commenting on the left side', quarantine: 'https://gitlab.com/gitlab-org/gitlab/issues/196826' do should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7"]', match: :first).find(:xpath, '..'), 'left') end diff --git a/spec/features/merge_request/user_sees_diff_spec.rb b/spec/features/merge_request/user_sees_diff_spec.rb index 2d91d09a486..2ef4a18f78d 100644 --- a/spec/features/merge_request/user_sees_diff_spec.rb +++ b/spec/features/merge_request/user_sees_diff_spec.rb @@ -76,7 +76,7 @@ describe 'Merge request > User sees diff', :js do end context 'as user who needs to fork' do - it 'shows fork/cancel confirmation', :sidekiq_might_not_need_inline do + it 'shows fork/cancel confirmation', :sidekiq_might_not_need_inline, quarantine: 'https://gitlab.com/gitlab-org/gitlab/issues/196749' do sign_in(user) visit diffs_project_merge_request_path(project, merge_request) diff --git a/spec/lib/gitlab/import_export/merge_request_parser_spec.rb b/spec/lib/gitlab/import_export/merge_request_parser_spec.rb index c437efede4c..ab834ac3fa8 100644 --- a/spec/lib/gitlab/import_export/merge_request_parser_spec.rb +++ b/spec/lib/gitlab/import_export/merge_request_parser_spec.rb @@ -40,8 +40,6 @@ describe Gitlab::ImportExport::MergeRequestParser do allow(instance).to receive(:branch_exists?).with(merge_request.source_branch).and_return(false) allow(instance).to receive(:fork_merge_request?).and_return(true) end - allow(Gitlab::GitalyClient).to receive(:migrate).and_call_original - allow(Gitlab::GitalyClient).to receive(:migrate).with(:fetch_ref).and_return([nil, 0]) expect(parsed_merge_request).to eq(merge_request) end diff --git a/spec/models/sentry_issue_spec.rb b/spec/models/sentry_issue_spec.rb index 7dc1cea4617..022cfd4734e 100644 --- a/spec/models/sentry_issue_spec.rb +++ b/spec/models/sentry_issue_spec.rb @@ -15,6 +15,18 @@ describe SentryIssue do it { is_expected.to validate_presence_of(:sentry_issue_identifier) } end + describe 'callbacks' do + context 'after create commit do' do + it 'updates Sentry with a reciprocal link on creation' do + issue = create(:issue) + + expect(ErrorTrackingIssueLinkWorker).to receive(:perform_async).with(issue.id) + + create(:sentry_issue, issue: issue) + end + end + end + describe '.for_project_and_identifier' do let!(:sentry_issue) { create(:sentry_issue) } let(:project) { sentry_issue.issue.project } diff --git a/spec/support/features/discussion_comments_shared_example.rb b/spec/support/features/discussion_comments_shared_example.rb index ea13e91860a..d19ac25db8c 100644 --- a/spec/support/features/discussion_comments_shared_example.rb +++ b/spec/support/features/discussion_comments_shared_example.rb @@ -269,7 +269,7 @@ shared_examples 'thread comments' do |resource_name| end end - it 'has "Comment" selected when opening the menu' do + it 'has "Comment" selected when opening the menu', quarantine: 'https://gitlab.com/gitlab-org/gitlab/issues/196825' do find(toggle_selector).click find("#{menu_selector} li", match: :first) diff --git a/spec/workers/error_tracking_issue_link_worker_spec.rb b/spec/workers/error_tracking_issue_link_worker_spec.rb new file mode 100644 index 00000000000..cf16e4a0803 --- /dev/null +++ b/spec/workers/error_tracking_issue_link_worker_spec.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe ErrorTrackingIssueLinkWorker do + let_it_be(:error_tracking) { create(:project_error_tracking_setting) } + let_it_be(:project) { error_tracking.project } + let_it_be(:issue) { create(:issue, project: project) } + let_it_be(:sentry_issue) { create(:sentry_issue, issue: issue) } + + let(:repo) do + Gitlab::ErrorTracking::Repo.new( + status: 'active', + integration_id: 66666, + project_id: project.id + ) + end + + subject { described_class.new.perform(issue.id) } + + describe '#perform' do + it 'creates a link between an issue and a Sentry issue in Sentry' do + expect_next_instance_of(Sentry::Client) do |client| + expect(client).to receive(:repos).with('sentry-org').and_return([repo]) + expect(client) + .to receive(:create_issue_link) + .with(66666, sentry_issue.sentry_issue_identifier, issue) + .and_return(true) + end + + expect(subject).to be true + end + + shared_examples_for 'makes no external API requests' do + it 'takes no action' do + expect_any_instance_of(Sentry::Client).not_to receive(:repos) + expect_any_instance_of(Sentry::Client).not_to receive(:create_issue_link) + + expect(subject).to be nil + end + end + + shared_examples_for 'terminates after one API request' do + it 'takes no action' do + expect_next_instance_of(Sentry::Client) do |client| + expect(client).to receive(:repos).with('sentry-org').and_return([repo]) + end + expect_any_instance_of(Sentry::Client).not_to receive(:create_issue_link) + + expect(subject).to be nil + end + end + + context 'when issue is unavailable' do + let(:issue) { double('issue', id: -3) } + + it_behaves_like 'makes no external API requests' + end + + context 'when project does not have error tracking configured' do + let(:issue) { build(:project) } + + it_behaves_like 'makes no external API requests' + end + + context 'when the issue is not linked to a Sentry issue in GitLab' do + let(:issue) { build(:issue, project: project) } + + it_behaves_like 'makes no external API requests' + end + + context 'when Sentry disabled the GitLab integration' do + let(:repo) do + Gitlab::ErrorTracking::Repo.new( + status: 'inactive', + integration_id: 66666, + project_id: project.id + ) + end + + it_behaves_like 'terminates after one API request' + end + + context 'when Sentry the GitLab integration is for another project' do + let(:repo) do + Gitlab::ErrorTracking::Repo.new( + status: 'active', + integration_id: 66666, + project_id: -3 + ) + end + + it_behaves_like 'terminates after one API request' + end + end +end |