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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-02 12:07:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-02 12:07:27 +0300
commit7e8ecb5c00aae3b7072a5b8ff2c53db03c0bc579 (patch)
treee89c4b3d7af5db6805951e2847472b2e29e77bfd /spec/requests
parentf58c22e1cd553626dbfa4f347afb86544865cfbe (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/admin/batched_background_migrations_spec.rb21
-rw-r--r--spec/requests/api/project_templates_spec.rb45
2 files changed, 21 insertions, 45 deletions
diff --git a/spec/requests/api/admin/batched_background_migrations_spec.rb b/spec/requests/api/admin/batched_background_migrations_spec.rb
index e88fba3fbe7..180b6c7abd6 100644
--- a/spec/requests/api/admin/batched_background_migrations_spec.rb
+++ b/spec/requests/api/admin/batched_background_migrations_spec.rb
@@ -50,6 +50,27 @@ RSpec.describe API::Admin::BatchedBackgroundMigrations, feature_category: :datab
show_migration
end
+
+ context 'when migration has completed jobs' do
+ let(:migration) do
+ Gitlab::Database::SharedModel.using_connection(ci_model.connection) do
+ create(:batched_background_migration, :active, total_tuple_count: 100)
+ end
+ end
+
+ let!(:batched_job) do
+ Gitlab::Database::SharedModel.using_connection(ci_model.connection) do
+ create(:batched_background_migration_job, :succeeded, batched_migration: migration, batch_size: 8)
+ end
+ end
+
+ it 'calculates the progress using the CI database' do
+ show_migration
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['progress']).to eq(8)
+ end
+ end
end
context 'when the database name does not exist' do
diff --git a/spec/requests/api/project_templates_spec.rb b/spec/requests/api/project_templates_spec.rb
index 91e5ed76c37..e1d156afd54 100644
--- a/spec/requests/api/project_templates_spec.rb
+++ b/spec/requests/api/project_templates_spec.rb
@@ -63,27 +63,6 @@ RSpec.describe API::ProjectTemplates, feature_category: :source_code_management
expect(json_response).to satisfy_one { |template| template['key'] == 'mit' }
end
- it 'returns metrics_dashboard_ymls' do
- get api("/projects/#{public_project.id}/templates/metrics_dashboard_ymls")
-
- expect(response).to have_gitlab_http_status(:ok)
- expect(response).to include_pagination_headers
- expect(response).to match_response_schema('public_api/v4/template_list')
- expect(json_response).to satisfy_one { |template| template['key'] == 'Default' }
- end
-
- context 'when metrics dashboard feature is unavailable' do
- before do
- stub_feature_flags(remove_monitor_metrics: true)
- end
-
- it 'returns 400 bad request like other unknown types' do
- get api("/projects/#{public_project.id}/templates/metrics_dashboard_ymls")
-
- expect(response).to have_gitlab_http_status(:bad_request)
- end
- end
-
it 'returns issue templates' do
get api("/projects/#{private_project.id}/templates/issues", developer)
@@ -176,26 +155,6 @@ RSpec.describe API::ProjectTemplates, feature_category: :source_code_management
expect(json_response['name']).to eq('Android')
end
- it 'returns a specific metrics_dashboard_yml' do
- get api("/projects/#{public_project.id}/templates/metrics_dashboard_ymls/Default")
-
- expect(response).to have_gitlab_http_status(:ok)
- expect(response).to match_response_schema('public_api/v4/template')
- expect(json_response['name']).to eq('Default')
- end
-
- context 'when metrics dashboard feature is unavailable' do
- before do
- stub_feature_flags(remove_monitor_metrics: true)
- end
-
- it 'returns 400 bad request like other unknown types' do
- get api("/projects/#{public_project.id}/templates/metrics_dashboard_ymls/Default")
-
- expect(response).to have_gitlab_http_status(:bad_request)
- end
- end
-
it 'returns a specific license' do
get api("/projects/#{public_project.id}/templates/licenses/mit")
@@ -256,10 +215,6 @@ RSpec.describe API::ProjectTemplates, feature_category: :source_code_management
subject { get api("/projects/#{url_encoded_path}/templates/gitlab_ci_ymls/Android") }
end
- it_behaves_like 'accepts project paths with dots' do
- subject { get api("/projects/#{url_encoded_path}/templates/metrics_dashboard_ymls/Default") }
- end
-
shared_examples 'path traversal attempt' do |template_type|
it 'rejects invalid filenames' do
get api("/projects/#{public_project.id}/templates/#{template_type}/%2e%2e%2fPython%2ea")