diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-13 18:07:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-13 18:07:15 +0300 |
commit | f62886ebffeda00b6972f1644097a6b9f5016453 (patch) | |
tree | 1626fb8ad823b781d2e0164211cc7a6a9633edc2 /spec/requests | |
parent | da104bbfec951988c5da3aa495091a31b7312aac (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/ml_model_packages_spec.rb | 22 | ||||
-rw-r--r-- | spec/requests/api/protected_branches_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/protected_tags_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/projects/tracing_controller_spec.rb | 14 |
4 files changed, 26 insertions, 14 deletions
diff --git a/spec/requests/api/ml_model_packages_spec.rb b/spec/requests/api/ml_model_packages_spec.rb index a559f1642e8..3166298b430 100644 --- a/spec/requests/api/ml_model_packages_spec.rb +++ b/spec/requests/api/ml_model_packages_spec.rb @@ -124,18 +124,18 @@ RSpec.describe ::API::MlModelPackages, feature_category: :mlops do project.send("add_#{user_role}", user) if member && user_role != :anonymous end - describe 'PUT /api/v4/projects/:id/packages/ml_models/:package_name/:package_version/:file_name/authorize' do + describe 'PUT /api/v4/projects/:id/packages/ml_models/:model_name/:model_version/:file_name/authorize' do include_context 'ml model authorize permissions table' let(:token) { tokens[:personal_access_token] } let(:user_headers) { { 'HTTP_AUTHORIZATION' => token } } let(:headers) { user_headers.merge(workhorse_headers) } let(:request) { authorize_upload_file(headers) } - let(:package_name) { 'my_package' } + let(:model_name) { 'my_package' } let(:file_name) { 'myfile.tar.gz' } subject(:api_response) do - url = "/projects/#{project.id}/packages/ml_models/#{package_name}/0.0.1/#{file_name}/authorize" + url = "/projects/#{project.id}/packages/ml_models/#{model_name}/0.0.1/#{file_name}/authorize" put api(url), headers: headers @@ -162,7 +162,7 @@ RSpec.describe ::API::MlModelPackages, feature_category: :mlops do end describe 'application security' do - where(:package_name, :file_name) do + where(:model_name, :file_name) do 'my-package/../' | 'myfile.tar.gz' 'my-package%2f%2e%2e%2f' | 'myfile.tar.gz' 'my_package' | '../.ssh%2fauthorized_keys' @@ -177,7 +177,7 @@ RSpec.describe ::API::MlModelPackages, feature_category: :mlops do end end - describe 'PUT /api/v4/projects/:id/packages/ml_models/:package_name/:package_version/:file_name' do + describe 'PUT /api/v4/projects/:id/packages/ml_models/:model_name/:model_version/:file_name' do include_context 'ml model authorize permissions table' let_it_be(:file_name) { 'model.md5' } @@ -188,10 +188,10 @@ RSpec.describe ::API::MlModelPackages, feature_category: :mlops do let(:params) { { file: temp_file(file_name) } } let(:file_key) { :file } let(:send_rewritten_field) { true } - let(:package_name) { 'my_package' } + let(:model_name) { 'my_package' } subject(:api_response) do - url = "/projects/#{project.id}/packages/ml_models/#{package_name}/0.0.1/#{file_name}" + url = "/projects/#{project.id}/packages/ml_models/#{model_name}/0.0.1/#{file_name}" workhorse_finalize( api(url), @@ -236,14 +236,14 @@ RSpec.describe ::API::MlModelPackages, feature_category: :mlops do end end - describe 'GET /api/v4/projects/:project_id/packages/ml_models/:package_name/:package_version/:file_name' do + describe 'GET /api/v4/projects/:project_id/packages/ml_models/:model_name/:model_version/:file_name' do include_context 'ml model authorize permissions table' let_it_be(:package) { create(:ml_model_package, project: project, name: 'model', version: '0.0.1') } let_it_be(:package_file) { create(:package_file, :generic, package: package, file_name: 'model.md5') } - let(:package_name) { package.name } - let(:package_version) { package.version } + let(:model_name) { package.name } + let(:model_version) { package.version } let(:file_name) { package_file.file_name } let(:token) { tokens[:personal_access_token] } @@ -251,7 +251,7 @@ RSpec.describe ::API::MlModelPackages, feature_category: :mlops do let(:headers) { user_headers.merge(workhorse_headers) } subject(:api_response) do - url = "/projects/#{project.id}/packages/ml_models/#{package_name}/#{package_version}/#{file_name}" + url = "/projects/#{project.id}/packages/ml_models/#{model_name}/#{model_version}/#{file_name}" get api(url), headers: headers diff --git a/spec/requests/api/protected_branches_spec.rb b/spec/requests/api/protected_branches_spec.rb index 04d5f7ac20a..ad3a69fec9d 100644 --- a/spec/requests/api/protected_branches_spec.rb +++ b/spec/requests/api/protected_branches_spec.rb @@ -121,7 +121,7 @@ RSpec.describe API::ProtectedBranches, feature_category: :source_code_management get api(route, user) expect(json_response['push_access_levels']).to include( - a_hash_including('access_level_description' => 'Deploy key', 'deploy_key_id' => deploy_key.id) + a_hash_including('access_level_description' => deploy_key.title, 'deploy_key_id' => deploy_key.id) ) end end diff --git a/spec/requests/api/protected_tags_spec.rb b/spec/requests/api/protected_tags_spec.rb index c6398e624f8..4e7227b2294 100644 --- a/spec/requests/api/protected_tags_spec.rb +++ b/spec/requests/api/protected_tags_spec.rb @@ -95,7 +95,7 @@ RSpec.describe API::ProtectedTags, feature_category: :source_code_management do get api(route, user) expect(json_response['create_access_levels']).to include( - a_hash_including('access_level_description' => 'Deploy key', 'deploy_key_id' => deploy_key.id) + a_hash_including('access_level_description' => deploy_key.title, 'deploy_key_id' => deploy_key.id) ) end end diff --git a/spec/requests/projects/tracing_controller_spec.rb b/spec/requests/projects/tracing_controller_spec.rb index 520e99b120a..eecaa0d962a 100644 --- a/spec/requests/projects/tracing_controller_spec.rb +++ b/spec/requests/projects/tracing_controller_spec.rb @@ -3,7 +3,8 @@ require 'spec_helper' RSpec.describe Projects::TracingController, feature_category: :tracing do - let_it_be(:project) { create(:project, :repository) } + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, group: group) } let_it_be(:user) { create(:user) } let(:path) { nil } let(:observability_tracing_ff) { true } @@ -44,6 +45,17 @@ RSpec.describe Projects::TracingController, feature_category: :tracing do expect(subject).to have_gitlab_http_status(:ok) end + it 'renders the js-tracing element correctly' do + element = Nokogiri::HTML.parse(subject.body).at_css('#js-tracing') + + expected_view_model = { + 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 + context 'when feature is disabled' do let(:observability_tracing_ff) { false } |