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:
Diffstat (limited to 'qa/qa/specs/features/browser_ui/4_verify/ci_project_artifacts/user_can_bulk_delete_artifacts_spec.rb')
-rw-r--r--qa/qa/specs/features/browser_ui/4_verify/ci_project_artifacts/user_can_bulk_delete_artifacts_spec.rb90
1 files changed, 90 insertions, 0 deletions
diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_project_artifacts/user_can_bulk_delete_artifacts_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_project_artifacts/user_can_bulk_delete_artifacts_spec.rb
new file mode 100644
index 00000000000..27969759adf
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/4_verify/ci_project_artifacts/user_can_bulk_delete_artifacts_spec.rb
@@ -0,0 +1,90 @@
+# frozen_string_literal: true
+
+module QA
+ RSpec.describe 'Verify', :runner, product_group: :pipeline_security do
+ describe 'Project artifacts' do
+ context 'when user tries bulk deletion' do
+ let(:total_jobs_count) { 20 }
+ let(:total_runners_count) { 5 }
+ let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(number: 8)}" }
+ let(:project) { create(:project, name: 'project-with-many-artifacts') }
+ let(:runners) { [] }
+
+ before do
+ launch_runners
+ commit_ci_file
+ Flow::Login.sign_in
+ wait_for_pipeline_to_succeed
+
+ project.visit!
+ Page::Project::Menu.perform(&:go_to_artifacts)
+ Page::Project::Artifacts::Index.perform(&:select_all)
+ end
+
+ after do
+ Parallel.each((0..(total_runners_count - 1)), in_threads: 3) do |i|
+ runners[i]&.remove_via_api!
+ end
+ end
+
+ it 'successfully delete them', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/425725' do
+ Page::Project::Artifacts::Index.perform do |index|
+ index.delete_selected_artifacts
+ position = rand(1..20)
+ artifacts_count = index.job_artifacts_count_by_row(row: position)
+ artifacts_size = index.job_artifacts_size_by_row(row: position)
+
+ aggregate_failures 'job artifacts count and size' do
+ expect(artifacts_count).to eq(0), 'Failed to delete artifact'
+ expect(artifacts_size).to eq(0), 'Failed to delete artifact'
+ end
+ end
+ end
+ end
+
+ private
+
+ def launch_runners
+ Parallel.each((1..total_runners_count), in_threads: 3) do |i|
+ runners << create(:project_runner, project: project, name: "#{executor}-#{i}", tags: [executor])
+ end
+ end
+
+ def commit_ci_file
+ Resource::Repository::Commit.fabricate_via_api! do |commit|
+ commit.project = project
+ commit.commit_message = 'Add .gitlab-ci.yml'
+ commit.add_files(
+ [
+ {
+ file_path: '.gitlab-ci.yml',
+ content: content
+ }
+ ]
+ )
+ end
+ end
+
+ def content
+ (1..total_jobs_count).map do |i|
+ <<~YAML
+ job_with_artifact_#{i}:
+ tags: ["#{executor}"]
+ script:
+ - mkdir tmp
+ - echo "write some random strings #{i} times" >> tmp/file_#{i}.xml
+ artifacts:
+ paths:
+ - tmp
+ YAML
+ end.join("\n")
+ end
+
+ def wait_for_pipeline_to_succeed
+ Support::Waiter.wait_until(message: 'Wait for pipeline to succeed', max_duration: 300) do
+ project.latest_pipeline.present? && project.latest_pipeline[:status] == 'success'
+ end
+ end
+ end
+ end
+end