diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-28 00:07:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-28 00:07:46 +0300 |
commit | d74abe41c00eedb95738a74b9bbdea67e423103b (patch) | |
tree | 754f93e47d205f0cb6908b6abb4cf7713bdef879 /spec/requests | |
parent | 7dd130e2cae40514f02b02922251b62302f2fdd5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/graphql/project/merge_requests_spec.rb | 10 | ||||
-rw-r--r-- | spec/requests/projects/tracing_controller_spec.rb | 60 |
2 files changed, 58 insertions, 12 deletions
diff --git a/spec/requests/api/graphql/project/merge_requests_spec.rb b/spec/requests/api/graphql/project/merge_requests_spec.rb index 3ad98ee09aa..05ed0ed8729 100644 --- a/spec/requests/api/graphql/project/merge_requests_spec.rb +++ b/spec/requests/api/graphql/project/merge_requests_spec.rb @@ -407,6 +407,16 @@ RSpec.describe 'getting merge request listings nested in a project', feature_cat end include_examples 'N+1 query check', skip_cached: false + + context 'when each merge request diff has no head_commit_sha' do + before do + [merge_request_a, merge_request_b, merge_request_c].each do |mr| + mr.merge_request_diffs.update!(head_commit_sha: nil) + end + end + + include_examples 'N+1 query check', skip_cached: false + end end end diff --git a/spec/requests/projects/tracing_controller_spec.rb b/spec/requests/projects/tracing_controller_spec.rb index eecaa0d962a..8996ea7f8d6 100644 --- a/spec/requests/projects/tracing_controller_spec.rb +++ b/spec/requests/projects/tracing_controller_spec.rb @@ -14,14 +14,12 @@ RSpec.describe Projects::TracingController, feature_category: :tracing do response end - describe 'GET #index' do - before do - stub_feature_flags(observability_tracing: observability_tracing_ff) - sign_in(user) - end - - let(:path) { project_tracing_index_path(project) } + before do + stub_feature_flags(observability_tracing: observability_tracing_ff) + sign_in(user) + end + shared_examples 'tracing route request' do it_behaves_like 'observability csp policy' do before_all do project.add_developer(user) @@ -45,6 +43,26 @@ RSpec.describe Projects::TracingController, feature_category: :tracing do expect(subject).to have_gitlab_http_status(:ok) end + context 'when feature is disabled' do + let(:observability_tracing_ff) { false } + + it 'returns 404' do + expect(subject).to have_gitlab_http_status(:not_found) + end + end + end + end + + describe 'GET #index' do + let(:path) { project_tracing_index_path(project) } + + it_behaves_like 'tracing route request' + + describe 'html response' do + before_all do + project.add_developer(user) + end + it 'renders the js-tracing element correctly' do element = Nokogiri::HTML.parse(subject.body).at_css('#js-tracing') @@ -55,13 +73,31 @@ RSpec.describe Projects::TracingController, feature_category: :tracing do }.to_json expect(element.attributes['data-view-model'].value).to eq(expected_view_model) end + end + end - context 'when feature is disabled' do - let(:observability_tracing_ff) { false } + describe 'GET #show' do + let(:path) { project_tracing_path(project, id: "test-trace-id") } - it 'returns 404' do - expect(subject).to have_gitlab_http_status(:not_found) - end + it_behaves_like 'tracing route request' + + describe 'html response' do + before_all do + project.add_developer(user) + end + + it 'renders the js-tracing element correctly' do + element = Nokogiri::HTML.parse(subject.body).at_css('#js-tracing-details') + + expected_view_model = { + tracingIndexUrl: project_tracing_index_path(project), + traceId: 'test-trace-id', + tracingUrl: Gitlab::Observability.tracing_url(project), + provisioningUrl: Gitlab::Observability.provisioning_url(project), + oauthUrl: Gitlab::Observability.oauth_url + }.to_json + + expect(element.attributes['data-view-model'].value).to eq(expected_view_model) end end end |