Commit a9f87077 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 2da3db98 72874d8b
...@@ -248,11 +248,15 @@ export default { ...@@ -248,11 +248,15 @@ export default {
<gl-badge <gl-badge
v-if="pipeline.flags.merge_train_pipeline" v-if="pipeline.flags.merge_train_pipeline"
v-gl-tooltip v-gl-tooltip
:title="__('This is a merge train pipeline')" :title="
s__(
'Pipeline|This pipeline ran on the contents of this merge request combined with the contents of all other merge requests queued for merging into the target branch.',
)
"
variant="info" variant="info"
size="sm" size="sm"
data-testid="pipeline-url-train" data-testid="pipeline-url-train"
>{{ __('train') }}</gl-badge >{{ s__('Pipeline|merge train') }}</gl-badge
> >
<gl-badge <gl-badge
v-if="pipeline.flags.yaml_errors" v-if="pipeline.flags.yaml_errors"
...@@ -320,14 +324,14 @@ export default { ...@@ -320,14 +324,14 @@ export default {
v-if="pipeline.flags.detached_merge_request_pipeline" v-if="pipeline.flags.detached_merge_request_pipeline"
v-gl-tooltip v-gl-tooltip
:title=" :title="
__( s__(
'Merge request pipelines are configured. A detached pipeline runs in the context of the merge request, and not against the merged result. Learn more in the documentation for merge request pipelines.', `Pipeline|This pipeline ran on the contents of this merge request's source branch, not the target branch.`,
) )
" "
variant="info" variant="info"
size="sm" size="sm"
data-testid="pipeline-url-detached" data-testid="pipeline-url-detached"
>{{ __('detached') }}</gl-badge >{{ s__('Pipeline|merge request') }}</gl-badge
> >
<gl-badge <gl-badge
v-if="isInFork" v-if="isInFork"
......
...@@ -30,8 +30,17 @@ module Resolvers ...@@ -30,8 +30,17 @@ module Resolvers
return [] if repository.empty? return [] if repository.empty?
ref ||= repository.root_ref ref ||= repository.root_ref
validate_ref(ref)
repository.blobs_at(paths.map { |path| [ref, path] }) repository.blobs_at(paths.map { |path| [ref, path] })
end end
private
def validate_ref(ref)
unless Gitlab::GitRefValidator.validate(ref)
raise Gitlab::Graphql::Errors::ArgumentError, 'Ref is not valid'
end
end
end end
end end
...@@ -60,7 +60,7 @@ module ErrorTracking ...@@ -60,7 +60,7 @@ module ErrorTracking
end end
def actor def actor
return event['transaction'] if event['transaction'] return event['transaction'] if event['transaction'].present?
# Some SDKs do not have a transaction attribute. # Some SDKs do not have a transaction attribute.
# So we build it by combining function name and module name from # So we build it by combining function name and module name from
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
- if @pipeline.latest? - if @pipeline.latest?
= gl_badge_tag s_('Pipelines|latest'), { variant: :success, size: :sm }, { class: 'js-pipeline-url-latest has-tooltip', title: _("Latest pipeline for the most recent commit on this branch") } = gl_badge_tag s_('Pipelines|latest'), { variant: :success, size: :sm }, { class: 'js-pipeline-url-latest has-tooltip', title: _("Latest pipeline for the most recent commit on this branch") }
- if @pipeline.merge_train_pipeline? - if @pipeline.merge_train_pipeline?
= gl_badge_tag s_('Pipelines|train'), { variant: :info, size: :sm }, { class: 'js-pipeline-url-train has-tooltip', title: _("This is a merge train pipeline") } = gl_badge_tag s_('Pipelines|merge train'), { variant: :info, size: :sm }, { class: 'js-pipeline-url-train has-tooltip', title: s_("Pipelines|This pipeline ran on the contents of this merge request combined with the contents of all other merge requests queued for merging into the target branch.") }
- if @pipeline.has_yaml_errors? - if @pipeline.has_yaml_errors?
= gl_badge_tag s_('Pipelines|yaml invalid'), { variant: :danger, size: :sm }, { class: 'js-pipeline-url-yaml has-tooltip', title: @pipeline.yaml_errors } = gl_badge_tag s_('Pipelines|yaml invalid'), { variant: :danger, size: :sm }, { class: 'js-pipeline-url-yaml has-tooltip', title: @pipeline.yaml_errors }
- if @pipeline.failure_reason? - if @pipeline.failure_reason?
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
- popover_content_text = _('Learn more about Auto DevOps') - popover_content_text = _('Learn more about Auto DevOps')
= gl_badge_tag s_('Pipelines|Auto DevOps'), { variant: :info, size: :sm }, { class: 'js-pipeline-url-autodevops', href: "#", tabindex: "0", role: "button", data: { container: 'body', toggle: 'popover', placement: 'top', html: 'true', triggers: 'focus', title: "<div class='gl-font-weight-normal gl-line-height-normal'>#{popover_title_text}</div>", content: "<a href='#{popover_content_url}' target='_blank' rel='noopener noreferrer nofollow'>#{popover_content_text}</a>" } } = gl_badge_tag s_('Pipelines|Auto DevOps'), { variant: :info, size: :sm }, { class: 'js-pipeline-url-autodevops', href: "#", tabindex: "0", role: "button", data: { container: 'body', toggle: 'popover', placement: 'top', html: 'true', triggers: 'focus', title: "<div class='gl-font-weight-normal gl-line-height-normal'>#{popover_title_text}</div>", content: "<a href='#{popover_content_url}' target='_blank' rel='noopener noreferrer nofollow'>#{popover_content_text}</a>" } }
- if @pipeline.detached_merge_request_pipeline? - if @pipeline.detached_merge_request_pipeline?
= gl_badge_tag s_('Pipelines|detached'), { variant: :info, size: :sm }, { class: 'js-pipeline-url-mergerequest has-tooltip', title: _('Merge request pipelines are configured. A detached pipeline runs in the context of the merge request, and not against the merged result. Learn more in the documentation for merge request pipelines.') } = gl_badge_tag s_('Pipelines|merge request'), { variant: :info, size: :sm }, { class: 'js-pipeline-url-mergerequest has-tooltip', title: s_("Pipelines|This pipeline ran on the contents of this merge request's source branch, not the target branch.") }
- if @pipeline.stuck? - if @pipeline.stuck?
= gl_badge_tag s_('Pipelines|stuck'), { variant: :warning, size: :sm }, { class: 'js-pipeline-url-stuck has-tooltip' } = gl_badge_tag s_('Pipelines|stuck'), { variant: :warning, size: :sm }, { class: 'js-pipeline-url-stuck has-tooltip' }
......
...@@ -775,8 +775,8 @@ the `approvals_before_merge` parameter: ...@@ -775,8 +775,8 @@ the `approvals_before_merge` parameter:
### Single merge request response notes ### Single merge request response notes
- The `merge_status` field may hold one of the following values: - The `merge_status` field may hold one of the following values:
- `unchecked`: We have not checked this yet. - `unchecked`: This merge request has not yet been checked.
- `checking`: We are currently checking if the merge request can be merged. - `checking`: This merge request is currently being checked to see if it can be merged.
- `can_be_merged`: This merge request can be merged without conflict. - `can_be_merged`: This merge request can be merged without conflict.
- `cannot_be_merged`: There are merge conflicts between the source and target branches. - `cannot_be_merged`: There are merge conflicts between the source and target branches.
- `cannot_be_merged_recheck`: Currently unchecked. Before the current changes, there were conflicts. - `cannot_be_merged_recheck`: Currently unchecked. Before the current changes, there were conflicts.
......
...@@ -662,7 +662,7 @@ Sidekiq processes](../administration/operations/extra_sidekiq_processes.md). ...@@ -662,7 +662,7 @@ Sidekiq processes](../administration/operations/extra_sidekiq_processes.md).
``` ```
You can also use the `gitlab:elastic:clear_index_status` Rake task to force the You can also use the `gitlab:elastic:clear_index_status` Rake task to force the
indexer to "forget" all progress, so it will retry the indexing process from the indexer to "forget" all progress, so it retries the indexing process from the
start. start.
1. Personal snippets are not associated with a project and need to be indexed separately: 1. Personal snippets are not associated with a project and need to be indexed separately:
......
...@@ -33,6 +33,10 @@ module Gitlab ...@@ -33,6 +33,10 @@ module Gitlab
def fetch_local_content def fetch_local_content
context.project.repository.blob_data_at(context.sha, location) context.project.repository.blob_data_at(context.sha, location)
rescue GRPC::InvalidArgument
errors.push("Sha #{context.sha} is not valid!")
nil
end end
override :expand_context_attrs override :expand_context_attrs
......
...@@ -22972,9 +22972,6 @@ msgstr "" ...@@ -22972,9 +22972,6 @@ msgstr ""
msgid "Merge request not merged" msgid "Merge request not merged"
msgstr "" msgstr ""
msgid "Merge request pipelines are configured. A detached pipeline runs in the context of the merge request, and not against the merged result. Learn more in the documentation for merge request pipelines."
msgstr ""
msgid "Merge request reports" msgid "Merge request reports"
msgstr "" msgstr ""
...@@ -27017,6 +27014,12 @@ msgstr "" ...@@ -27017,6 +27014,12 @@ msgstr ""
msgid "Pipelines|This is a child pipeline within the parent pipeline" msgid "Pipelines|This is a child pipeline within the parent pipeline"
msgstr "" msgstr ""
msgid "Pipelines|This pipeline ran on the contents of this merge request combined with the contents of all other merge requests queued for merging into the target branch."
msgstr ""
msgid "Pipelines|This pipeline ran on the contents of this merge request's source branch, not the target branch."
msgstr ""
msgid "Pipelines|This pipeline will run code originating from a forked project merge request. This means that the code can potentially have security considerations like exposing CI variables." msgid "Pipelines|This pipeline will run code originating from a forked project merge request. This means that the code can potentially have security considerations like exposing CI variables."
msgstr "" msgstr ""
...@@ -27059,9 +27062,6 @@ msgstr "" ...@@ -27059,9 +27062,6 @@ msgstr ""
msgid "Pipelines|Your changes have been successfully committed. Now redirecting to the new merge request page." msgid "Pipelines|Your changes have been successfully committed. Now redirecting to the new merge request page."
msgstr "" msgstr ""
msgid "Pipelines|detached"
msgstr ""
msgid "Pipelines|error" msgid "Pipelines|error"
msgstr "" msgstr ""
...@@ -27071,10 +27071,13 @@ msgstr "" ...@@ -27071,10 +27071,13 @@ msgstr ""
msgid "Pipelines|latest" msgid "Pipelines|latest"
msgstr "" msgstr ""
msgid "Pipelines|stuck" msgid "Pipelines|merge request"
msgstr ""
msgid "Pipelines|merge train"
msgstr "" msgstr ""
msgid "Pipelines|train" msgid "Pipelines|stuck"
msgstr "" msgstr ""
msgid "Pipelines|yaml invalid" msgid "Pipelines|yaml invalid"
...@@ -27206,6 +27209,12 @@ msgstr "" ...@@ -27206,6 +27209,12 @@ msgstr ""
msgid "Pipeline|This change will not change the overall test coverage if merged." msgid "Pipeline|This change will not change the overall test coverage if merged."
msgstr "" msgstr ""
msgid "Pipeline|This pipeline ran on the contents of this merge request combined with the contents of all other merge requests queued for merging into the target branch."
msgstr ""
msgid "Pipeline|This pipeline ran on the contents of this merge request's source branch, not the target branch."
msgstr ""
msgid "Pipeline|Trigger author" msgid "Pipeline|Trigger author"
msgstr "" msgstr ""
...@@ -27230,6 +27239,12 @@ msgstr "" ...@@ -27230,6 +27239,12 @@ msgstr ""
msgid "Pipeline|for" msgid "Pipeline|for"
msgstr "" msgstr ""
msgid "Pipeline|merge request"
msgstr ""
msgid "Pipeline|merge train"
msgstr ""
msgid "Pipeline|on" msgid "Pipeline|on"
msgstr "" msgstr ""
...@@ -37452,9 +37467,6 @@ msgstr "" ...@@ -37452,9 +37467,6 @@ msgstr ""
msgid "This is a list of devices that have logged into your account. Revoke any sessions that you do not recognize." msgid "This is a list of devices that have logged into your account. Revoke any sessions that you do not recognize."
msgstr "" msgstr ""
msgid "This is a merge train pipeline"
msgstr ""
msgid "This is a private email address %{helpIcon} generated just for you. Anyone who has it can create issues or merge requests as if they were you. If that happens, %{resetLinkStart}reset this token%{resetLinkEnd}." msgid "This is a private email address %{helpIcon} generated just for you. Anyone who has it can create issues or merge requests as if they were you. If that happens, %{resetLinkStart}reset this token%{resetLinkEnd}."
msgstr "" msgstr ""
...@@ -43290,9 +43302,6 @@ msgstr "" ...@@ -43290,9 +43302,6 @@ msgstr ""
msgid "design" msgid "design"
msgstr "" msgstr ""
msgid "detached"
msgstr ""
msgid "disabled" msgid "disabled"
msgstr "" msgstr ""
...@@ -44448,9 +44457,6 @@ msgstr "" ...@@ -44448,9 +44457,6 @@ msgstr ""
msgid "toggle collapse" msgid "toggle collapse"
msgstr "" msgstr ""
msgid "train"
msgstr ""
msgid "triggered" msgid "triggered"
msgstr "" msgstr ""
......
...@@ -25,6 +25,8 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request', ...@@ -25,6 +25,8 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
} }
end end
let(:expected_detached_mr_tag) {'merge request'}
before do before do
stub_application_setting(auto_devops_enabled: false) stub_application_setting(auto_devops_enabled: false)
stub_ci_pipeline_yaml_file(YAML.dump(config)) stub_ci_pipeline_yaml_file(YAML.dump(config))
...@@ -118,16 +120,16 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request', ...@@ -118,16 +120,16 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
it 'sees detached tag for detached merge request pipelines' do it 'sees detached tag for detached merge request pipelines' do
page.within('.ci-table') do page.within('.ci-table') do
expect(all('.pipeline-tags')[0]) expect(all('.pipeline-tags')[0])
.to have_content("detached") .to have_content(expected_detached_mr_tag)
expect(all('.pipeline-tags')[1]) expect(all('.pipeline-tags')[1])
.to have_content("detached") .to have_content(expected_detached_mr_tag)
expect(all('.pipeline-tags')[2]) expect(all('.pipeline-tags')[2])
.not_to have_content("detached") .not_to have_content(expected_detached_mr_tag)
expect(all('.pipeline-tags')[3]) expect(all('.pipeline-tags')[3])
.not_to have_content("detached") .not_to have_content(expected_detached_mr_tag)
end end
end end
...@@ -312,16 +314,16 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request', ...@@ -312,16 +314,16 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
it 'sees detached tag for detached merge request pipelines' do it 'sees detached tag for detached merge request pipelines' do
page.within('.ci-table') do page.within('.ci-table') do
expect(all('.pipeline-tags')[0]) expect(all('.pipeline-tags')[0])
.to have_content("detached") .to have_content(expected_detached_mr_tag)
expect(all('.pipeline-tags')[1]) expect(all('.pipeline-tags')[1])
.to have_content("detached") .to have_content(expected_detached_mr_tag)
expect(all('.pipeline-tags')[2]) expect(all('.pipeline-tags')[2])
.not_to have_content("detached") .not_to have_content(expected_detached_mr_tag)
expect(all('.pipeline-tags')[3]) expect(all('.pipeline-tags')[3])
.not_to have_content("detached") .not_to have_content(expected_detached_mr_tag)
end end
end end
......
...@@ -186,7 +186,7 @@ RSpec.describe 'Merge request > User sees pipelines', :js do ...@@ -186,7 +186,7 @@ RSpec.describe 'Merge request > User sees pipelines', :js do
page.within(first('.commit')) do page.within(first('.commit')) do
page.within('.pipeline-tags') do page.within('.pipeline-tags') do
expect(page.find('[data-testid="pipeline-url-link"]')[:href]).to include(expected_project.full_path) expect(page.find('[data-testid="pipeline-url-link"]')[:href]).to include(expected_project.full_path)
expect(page).to have_content('detached') expect(page).to have_content('merge request')
end end
page.within('.pipeline-triggerer') do page.within('.pipeline-triggerer') do
expect(page).to have_link(href: user_path(actor)) expect(page).to have_link(href: user_path(actor))
......
...@@ -1413,7 +1413,7 @@ RSpec.describe 'Pipeline', :js do ...@@ -1413,7 +1413,7 @@ RSpec.describe 'Pipeline', :js do
it 'contains badge that indicates detached merge request pipeline' do it 'contains badge that indicates detached merge request pipeline' do
page.within(all('.well-segment')[1]) do page.within(all('.well-segment')[1]) do
expect(page).to have_content 'detached' expect(page).to have_content 'merge request'
end end
end end
end end
......
...@@ -7,6 +7,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -7,6 +7,7 @@ RSpec.describe 'Pipelines', :js do
include Spec::Support::Helpers::ModalHelpers include Spec::Support::Helpers::ModalHelpers
let(:project) { create(:project) } let(:project) { create(:project) }
let(:expected_detached_mr_tag) {'merge request'}
context 'when user is logged in' do context 'when user is logged in' do
let(:user) { create(:user) } let(:user) { create(:user) }
...@@ -181,7 +182,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -181,7 +182,7 @@ RSpec.describe 'Pipelines', :js do
shared_examples_for 'detached merge request pipeline' do shared_examples_for 'detached merge request pipeline' do
it 'shows pipeline information without pipeline ref', :sidekiq_might_not_need_inline do it 'shows pipeline information without pipeline ref', :sidekiq_might_not_need_inline do
within '.pipeline-tags' do within '.pipeline-tags' do
expect(page).to have_content('detached') expect(page).to have_content(expected_detached_mr_tag)
end end
within '.branch-commit' do within '.branch-commit' do
...@@ -225,7 +226,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -225,7 +226,7 @@ RSpec.describe 'Pipelines', :js do
shared_examples_for 'detached merge request pipeline' do shared_examples_for 'detached merge request pipeline' do
it 'shows pipeline information without pipeline ref', :sidekiq_might_not_need_inline do it 'shows pipeline information without pipeline ref', :sidekiq_might_not_need_inline do
within '.pipeline-tags' do within '.pipeline-tags' do
expect(page).to have_content('detached') expect(page).to have_content(expected_detached_mr_tag)
expect(page).to have_link(merge_request.iid, expect(page).to have_link(merge_request.iid,
href: project_merge_request_path(project, merge_request)) href: project_merge_request_path(project, merge_request))
...@@ -266,7 +267,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -266,7 +267,7 @@ RSpec.describe 'Pipelines', :js do
shared_examples_for 'Correct merge request pipeline information' do shared_examples_for 'Correct merge request pipeline information' do
it 'does not show detached tag for the pipeline, and shows the link of the merge request, and does not show the ref of the pipeline', :sidekiq_might_not_need_inline do it 'does not show detached tag for the pipeline, and shows the link of the merge request, and does not show the ref of the pipeline', :sidekiq_might_not_need_inline do
within '.pipeline-tags' do within '.pipeline-tags' do
expect(page).not_to have_content('detached') expect(page).not_to have_content(expected_detached_mr_tag)
end end
within '.branch-commit' do within '.branch-commit' do
...@@ -311,7 +312,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -311,7 +312,7 @@ RSpec.describe 'Pipelines', :js do
shared_examples_for 'Correct merge request pipeline information' do shared_examples_for 'Correct merge request pipeline information' do
it 'does not show detached tag for the pipeline, and shows the link of the merge request, and does not show the ref of the pipeline', :sidekiq_might_not_need_inline do it 'does not show detached tag for the pipeline, and shows the link of the merge request, and does not show the ref of the pipeline', :sidekiq_might_not_need_inline do
within '.pipeline-tags' do within '.pipeline-tags' do
expect(page).not_to have_content('detached') expect(page).not_to have_content(expected_detached_mr_tag)
expect(page).to have_link(merge_request.iid, expect(page).to have_link(merge_request.iid,
href: project_merge_request_path(project, merge_request)) href: project_merge_request_path(project, merge_request))
......
{
"event_id": "dquJXuPF9sP1fMy5RpKo979xUALjNDQB",
"timestamp": 1645191605.123456,
"platform": "php",
"sdk": {
"name": "sentry.php",
"version": "3.3.7"
},
"logger": "php",
"transaction": "",
"server_name": "oAjA5zTgIjqP",
"release": "C0FFEE",
"environment": "Development/Berlin",
"exception": {
"values": [
{
"type": "TestException",
"value": "Sentry test exception",
"stacktrace": {
"frames": [
{
"filename": "/src/Path/To/Class.php",
"lineno": 3,
"in_app": true,
"abs_path": "/var/www/html/src/Path/To/Class.php",
"function": "Path\\To\\Class::method",
"raw_function": "Path\\To\\Class::method",
"pre_context": [
"// Pre-context"
],
"context_line": "throw new TestException('Sentry test exception');",
"post_context": [
"// Post-context"
]
}
]
},
"mechanism": {
"type": "generic",
"handled": true
}
}
]
}
}
...@@ -132,7 +132,7 @@ describe('Pipeline Url Component', () => { ...@@ -132,7 +132,7 @@ describe('Pipeline Url Component', () => {
...detachedMRPipeline, ...detachedMRPipeline,
}); });
expect(findDetachedTag().text()).toContain('detached'); expect(findDetachedTag().text()).toBe('merge request');
}); });
it('should render error badge when pipeline has a failure reason set', () => { it('should render error badge when pipeline has a failure reason set', () => {
...@@ -180,7 +180,7 @@ describe('Pipeline Url Component', () => { ...@@ -180,7 +180,7 @@ describe('Pipeline Url Component', () => {
...mergeTrainPipeline, ...mergeTrainPipeline,
}); });
expect(findTrainTag().text()).toContain('train'); expect(findTrainTag().text()).toBe('merge train');
}); });
it('should not render the train badge when the pipeline is not a merge train pipeline', () => { it('should not render the train badge when the pipeline is not a merge train pipeline', () => {
......
...@@ -68,6 +68,28 @@ RSpec.describe Resolvers::BlobsResolver do ...@@ -68,6 +68,28 @@ RSpec.describe Resolvers::BlobsResolver do
) )
end end
end end
context 'when specifying an invalid ref' do
let(:ref) { 'ma:in' }
it 'raises an ArgumentError' do
expect { resolve_blobs }.to raise_error(
Gitlab::Graphql::Errors::ArgumentError,
'Ref is not valid'
)
end
end
context 'when passing an empty ref' do
let(:ref) { '' }
it 'raises an ArgumentError' do
expect { resolve_blobs }.to raise_error(
Gitlab::Graphql::Errors::ArgumentError,
'Ref is not valid'
)
end
end
end end
end end
end end
......
...@@ -81,6 +81,16 @@ RSpec.describe Gitlab::Ci::Config::External::File::Local do ...@@ -81,6 +81,16 @@ RSpec.describe Gitlab::Ci::Config::External::File::Local do
expect(local_file.valid?).to be_falsy expect(local_file.valid?).to be_falsy
end end
end end
context 'when the given sha is not valid' do
let(:location) { '/lib/gitlab/ci/templates/existent-file.yml' }
let(:sha) { ':' }
it 'returns false and adds an error message stating that included file does not exist' do
expect(local_file).not_to be_valid
expect(local_file.errors).to include("Sha #{sha} is not valid!")
end
end
end end
describe '#content' do describe '#content' do
......
...@@ -171,6 +171,12 @@ RSpec.describe API::ErrorTracking::Collector do ...@@ -171,6 +171,12 @@ RSpec.describe API::ErrorTracking::Collector do
it_behaves_like 'successful request' it_behaves_like 'successful request'
end end
context 'when JSON key transaction is empty string' do
let_it_be(:raw_event) { fixture_file('error_tracking/php_empty_transaction.json') }
it_behaves_like 'successful request'
end
context 'sentry_key as param and empty headers' do context 'sentry_key as param and empty headers' do
let(:url) { "/error_tracking/collector/api/#{project.id}/store?sentry_key=#{sentry_key}" } let(:url) { "/error_tracking/collector/api/#{project.id}/store?sentry_key=#{sentry_key}" }
let(:headers) { {} } let(:headers) { {} }
......
...@@ -51,25 +51,30 @@ RSpec.describe ErrorTracking::CollectErrorService do ...@@ -51,25 +51,30 @@ RSpec.describe ErrorTracking::CollectErrorService do
end end
end end
context 'unusual payload' do context 'with unusual payload' do
let(:modified_event) { parsed_event } let(:modified_event) { parsed_event }
let(:event) { described_class.new(project, nil, event: modified_event).execute }
context 'missing transaction' do context 'when transaction is missing' do
it 'builds actor from stacktrace' do it 'builds actor from stacktrace' do
modified_event.delete('transaction') modified_event.delete('transaction')
event = described_class.new(project, nil, event: modified_event).execute expect(event.error.actor).to eq 'find()'
end
end
context 'when transaction is an empty string' do \
it 'builds actor from stacktrace' do
modified_event['transaction'] = ''
expect(event.error.actor).to eq 'find()' expect(event.error.actor).to eq 'find()'
end end
end end
context 'timestamp is numeric' do context 'when timestamp is numeric' do
it 'parses timestamp' do it 'parses timestamp' do
modified_event['timestamp'] = '1631015580.50' modified_event['timestamp'] = '1631015580.50'
event = described_class.new(project, nil, event: modified_event).execute
expect(event.occurred_at).to eq '2021-09-07T11:53:00.5' expect(event.occurred_at).to eq '2021-09-07T11:53:00.5'
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment