diff options
Diffstat (limited to 'spec/services/ci')
52 files changed, 480 insertions, 122 deletions
diff --git a/spec/services/ci/archive_trace_service_spec.rb b/spec/services/ci/archive_trace_service_spec.rb index ba94013b574..07ea314debc 100644 --- a/spec/services/ci/archive_trace_service_spec.rb +++ b/spec/services/ci/archive_trace_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::ArchiveTraceService, '#execute' do +RSpec.describe Ci::ArchiveTraceService, '#execute' do subject { described_class.new.execute(job, worker_name: ArchiveTraceWorker.name) } context 'when job is finished' do diff --git a/spec/services/ci/build_report_result_service_spec.rb b/spec/services/ci/build_report_result_service_spec.rb index dbdfc774314..3c1ef5301fc 100644 --- a/spec/services/ci/build_report_result_service_spec.rb +++ b/spec/services/ci/build_report_result_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::BuildReportResultService do +RSpec.describe Ci::BuildReportResultService do describe "#execute" do subject(:build_report_result) { described_class.new.execute(build) } diff --git a/spec/services/ci/cancel_user_pipelines_service_spec.rb b/spec/services/ci/cancel_user_pipelines_service_spec.rb index b18bf48a50a..12117051b64 100644 --- a/spec/services/ci/cancel_user_pipelines_service_spec.rb +++ b/spec/services/ci/cancel_user_pipelines_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::CancelUserPipelinesService do +RSpec.describe Ci::CancelUserPipelinesService do describe '#execute' do let(:user) { create(:user) } diff --git a/spec/services/ci/compare_accessibility_reports_service_spec.rb b/spec/services/ci/compare_accessibility_reports_service_spec.rb index aee1fd14bc5..6903a633eeb 100644 --- a/spec/services/ci/compare_accessibility_reports_service_spec.rb +++ b/spec/services/ci/compare_accessibility_reports_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::CompareAccessibilityReportsService do +RSpec.describe Ci::CompareAccessibilityReportsService do let(:service) { described_class.new(project) } let(:project) { create(:project, :repository) } diff --git a/spec/services/ci/compare_test_reports_service_spec.rb b/spec/services/ci/compare_test_reports_service_spec.rb index 46f4d2d42ff..7d31db73b6a 100644 --- a/spec/services/ci/compare_test_reports_service_spec.rb +++ b/spec/services/ci/compare_test_reports_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::CompareTestReportsService do +RSpec.describe Ci::CompareTestReportsService do let(:service) { described_class.new(project) } let(:project) { create(:project, :repository) } diff --git a/spec/services/ci/create_cross_project_pipeline_service_spec.rb b/spec/services/ci/create_cross_project_pipeline_service_spec.rb index 9e2497854bc..1aabdb85afd 100644 --- a/spec/services/ci/create_cross_project_pipeline_service_spec.rb +++ b/spec/services/ci/create_cross_project_pipeline_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::CreateCrossProjectPipelineService, '#execute' do +RSpec.describe Ci::CreateCrossProjectPipelineService, '#execute' do let_it_be(:user) { create(:user) } let(:upstream_project) { create(:project, :repository) } let_it_be(:downstream_project) { create(:project, :repository) } diff --git a/spec/services/ci/create_job_artifacts_service_spec.rb b/spec/services/ci/create_job_artifacts_service_spec.rb index 4d49923a184..3f5cf079025 100644 --- a/spec/services/ci/create_job_artifacts_service_spec.rb +++ b/spec/services/ci/create_job_artifacts_service_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' -describe Ci::CreateJobArtifactsService do +RSpec.describe Ci::CreateJobArtifactsService do let_it_be(:project) { create(:project) } - let(:service) { described_class.new(project) } + let(:service) { described_class.new(job) } let(:job) { create(:ci_build, project: project) } let(:artifacts_sha256) { '0' * 64 } let(:metadata_file) { nil } @@ -17,7 +17,7 @@ describe Ci::CreateJobArtifactsService do { 'artifact_type' => 'archive', 'artifact_format' => 'zip' - } + }.with_indifferent_access end def file_to_upload(path, params = {}) @@ -28,27 +28,7 @@ describe Ci::CreateJobArtifactsService do end describe '#execute' do - subject { service.execute(job, artifacts_file, params, metadata_file: metadata_file) } - - context 'locking' do - let(:old_job) { create(:ci_build, pipeline: create(:ci_pipeline, project: job.project, ref: job.ref)) } - let!(:latest_artifact) { create(:ci_job_artifact, job: old_job, locked: true) } - let!(:other_artifact) { create(:ci_job_artifact, locked: true) } - - it 'locks the new artifact' do - subject - - expect(Ci::JobArtifact.last).to have_attributes(locked: true) - end - - it 'unlocks all other artifacts for the same ref' do - expect { subject }.to change { latest_artifact.reload.locked }.from(true).to(false) - end - - it 'does not unlock artifacts for other refs' do - expect { subject }.not_to change { other_artifact.reload.locked }.from(true) - end - end + subject { service.execute(artifacts_file, params, metadata_file: metadata_file) } context 'when artifacts file is uploaded' do it 'saves artifact for the given type' do @@ -150,7 +130,7 @@ describe Ci::CreateJobArtifactsService do { 'artifact_type' => 'dotenv', 'artifact_format' => 'gzip' - } + }.with_indifferent_access end it 'calls parse service' do @@ -186,7 +166,7 @@ describe Ci::CreateJobArtifactsService do { 'artifact_type' => 'cluster_applications', 'artifact_format' => 'gzip' - } + }.with_indifferent_access end it 'calls cluster applications parse service' do diff --git a/spec/services/ci/create_pipeline_service/cache_spec.rb b/spec/services/ci/create_pipeline_service/cache_spec.rb index 4e0567132ff..614e46f1b1a 100644 --- a/spec/services/ci/create_pipeline_service/cache_spec.rb +++ b/spec/services/ci/create_pipeline_service/cache_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::CreatePipelineService do +RSpec.describe Ci::CreatePipelineService do context 'cache' do let(:user) { create(:admin) } let(:ref) { 'refs/heads/master' } diff --git a/spec/services/ci/create_pipeline_service/creation_errors_and_warnings_spec.rb b/spec/services/ci/create_pipeline_service/creation_errors_and_warnings_spec.rb new file mode 100644 index 00000000000..16205529f1c --- /dev/null +++ b/spec/services/ci/create_pipeline_service/creation_errors_and_warnings_spec.rb @@ -0,0 +1,114 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Ci::CreatePipelineService do + describe 'creation errors and warnings' do + let_it_be(:user) { create(:admin) } + let_it_be(:project) { create(:project, :repository, creator: user) } + + let(:ref) { 'refs/heads/master' } + let(:source) { :push } + let(:service) { described_class.new(project, user, { ref: ref }) } + let(:pipeline) { service.execute(source) } + + before do + stub_ci_pipeline_yaml_file(config) + stub_feature_flags(ci_raise_job_rules_without_workflow_rules_warning: true) + end + + context 'when created successfully' do + context 'when warnings are raised' do + let(:config) do + <<~YAML + test: + script: rspec + rules: + - if: '$CI_COMMIT_BRANCH' + YAML + end + + it 'contains only warnings' do + expect(pipeline.error_messages.map(&:content)).to be_empty + + expect(pipeline.warning_messages.map(&:content)).to contain_exactly( + 'jobs:test uses `rules` without defining `workflow:rules`' + ) + end + + context 'when feature flag is disabled for the particular warning' do + before do + stub_feature_flags(ci_raise_job_rules_without_workflow_rules_warning: false) + end + + it 'does not contain warnings' do + expect(pipeline.error_messages.map(&:content)).to be_empty + + expect(pipeline.warning_messages.map(&:content)).to be_empty + end + end + end + + context 'when no warnings are raised' do + let(:config) do + <<~YAML + test: + script: rspec + YAML + end + + it 'contains no warnings' do + expect(pipeline.error_messages).to be_empty + + expect(pipeline.warning_messages).to be_empty + end + end + end + + context 'when failed to create the pipeline' do + context 'when warnings are raised' do + let(:config) do + <<~YAML + build: + stage: build + script: echo + needs: [test] + test: + stage: test + script: echo + rules: + - if: '$CI_COMMIT_BRANCH' + YAML + end + + it 'contains both errors and warnings' do + error_message = 'build job: need test is not defined in prior stages' + warning_message = 'jobs:test uses `rules` without defining `workflow:rules`' + + expect(pipeline.yaml_errors).to eq(error_message) + expect(pipeline.error_messages.map(&:content)).to contain_exactly(error_message) + expect(pipeline.errors.full_messages).to contain_exactly(error_message) + + expect(pipeline.warning_messages.map(&:content)).to contain_exactly(warning_message) + end + end + + context 'when no warnings are raised' do + let(:config) do + <<~YAML + invalid: yaml + YAML + end + + it 'contains only errors' do + error_message = 'root config contains unknown keys: invalid' + expect(pipeline.yaml_errors).to eq(error_message) + expect(pipeline.error_messages.map(&:content)).to contain_exactly(error_message) + expect(pipeline.errors.full_messages).to contain_exactly(error_message) + + expect(pipeline.warning_messages).to be_empty + end + end + end + end +end diff --git a/spec/services/ci/create_pipeline_service/custom_config_content_spec.rb b/spec/services/ci/create_pipeline_service/custom_config_content_spec.rb index 5980260a08a..122870e0f3a 100644 --- a/spec/services/ci/create_pipeline_service/custom_config_content_spec.rb +++ b/spec/services/ci/create_pipeline_service/custom_config_content_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -describe Ci::CreatePipelineService do +RSpec.describe Ci::CreatePipelineService do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:admin) } let(:ref) { 'refs/heads/master' } diff --git a/spec/services/ci/create_pipeline_service/needs_spec.rb b/spec/services/ci/create_pipeline_service/needs_spec.rb index 17b9cf80cc1..915dc46d664 100644 --- a/spec/services/ci/create_pipeline_service/needs_spec.rb +++ b/spec/services/ci/create_pipeline_service/needs_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::CreatePipelineService do +RSpec.describe Ci::CreatePipelineService do context 'needs' do let_it_be(:user) { create(:admin) } let_it_be(:project) { create(:project, :repository, creator: user) } diff --git a/spec/services/ci/create_pipeline_service/parameter_content_spec.rb b/spec/services/ci/create_pipeline_service/parameter_content_spec.rb new file mode 100644 index 00000000000..5157574ea04 --- /dev/null +++ b/spec/services/ci/create_pipeline_service/parameter_content_spec.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Ci::CreatePipelineService do + let_it_be(:project) { create(:project, :repository) } + let_it_be(:user) { create(:admin) } + let(:service) { described_class.new(project, user, { ref: 'refs/heads/master' }) } + let(:content) do + <<~EOY + --- + stages: + - dast + + variables: + DAST_VERSION: 1 + SECURE_ANALYZERS_PREFIX: "registry.gitlab.com/gitlab-org/security-products/analyzers" + + dast: + stage: dast + image: + name: "$SECURE_ANALYZERS_PREFIX/dast:$DAST_VERSION" + variables: + GIT_STRATEGY: none + script: + - /analyze + EOY + end + + describe '#execute' do + context 'when source is a dangling build' do + subject { service.execute(:ondemand_dast_scan, content: content) } + + context 'parameter config content' do + it 'creates a pipeline' do + expect(subject).to be_persisted + end + + it 'creates builds with the correct names' do + expect(subject.builds.pluck(:name)).to match_array %w[dast] + end + + it 'creates stages with the correct names' do + expect(subject.stages.pluck(:name)).to match_array %w[dast] + end + + it 'sets the correct config source' do + expect(subject.config_source).to eq 'parameter_source' + end + end + end + + context 'when source is not a dangling build' do + subject { service.execute(:web, content: content) } + + it 'raises an exception' do + klass = Gitlab::Ci::Pipeline::Chain::Config::Content::Parameter::UnsupportedSourceError + expect { subject }.to raise_error(klass) + end + end + end +end diff --git a/spec/services/ci/create_pipeline_service/parent_child_pipeline_spec.rb b/spec/services/ci/create_pipeline_service/parent_child_pipeline_spec.rb index a76e83f2d60..016a5dfd18b 100644 --- a/spec/services/ci/create_pipeline_service/parent_child_pipeline_spec.rb +++ b/spec/services/ci/create_pipeline_service/parent_child_pipeline_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::CreatePipelineService, '#execute' do +RSpec.describe Ci::CreatePipelineService, '#execute' do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } let(:ref_name) { 'master' } diff --git a/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb b/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb index 2b11b98f58c..00a2dd74968 100644 --- a/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb +++ b/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -describe Ci::CreatePipelineService do +RSpec.describe Ci::CreatePipelineService do describe '.pre/.post stages' do let_it_be(:user) { create(:admin) } let_it_be(:project) { create(:project, :repository, creator: user) } diff --git a/spec/services/ci/create_pipeline_service/rules_spec.rb b/spec/services/ci/create_pipeline_service/rules_spec.rb index 713d230731b..1a1fa6e8f5d 100644 --- a/spec/services/ci/create_pipeline_service/rules_spec.rb +++ b/spec/services/ci/create_pipeline_service/rules_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -describe Ci::CreatePipelineService do +RSpec.describe Ci::CreatePipelineService do let(:user) { create(:admin) } let(:ref) { 'refs/heads/master' } let(:source) { :push } diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index b9456d5fcd4..9dc518be996 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::CreatePipelineService do +RSpec.describe Ci::CreatePipelineService do include ProjectForksHelper let_it_be(:project, reload: true) { create(:project, :repository) } @@ -80,7 +80,7 @@ describe Ci::CreatePipelineService do it 'records pipeline size in a prometheus histogram' do histogram = spy('pipeline size histogram') - allow(Gitlab::Ci::Pipeline::Chain::Metrics) + allow(Gitlab::Ci::Pipeline::Metrics) .to receive(:new).and_return(histogram) execute_service @@ -194,6 +194,7 @@ describe Ci::CreatePipelineService do expect(head_pipeline).to be_persisted expect(head_pipeline.yaml_errors).to be_present + expect(head_pipeline.messages).to be_present expect(merge_request.reload.head_pipeline).to eq head_pipeline end end @@ -511,7 +512,7 @@ describe Ci::CreatePipelineService do it 'pull it from Auto-DevOps' do pipeline = execute_service expect(pipeline).to be_auto_devops_source - expect(pipeline.builds.map(&:name)).to match_array(%w[test code_quality build]) + expect(pipeline.builds.map(&:name)).to match_array(%w[build code_quality eslint-sast test]) end end @@ -1683,6 +1684,12 @@ describe Ci::CreatePipelineService do expect(pipeline).to be_persisted expect(pipeline.builds.pluck(:name)).to contain_exactly("build_a", "test_a") end + + it 'bulk inserts all needs' do + expect(Ci::BuildNeed).to receive(:bulk_insert!).and_call_original + + expect(pipeline).to be_persisted + end end context 'when pipeline on feature is created' do @@ -1695,6 +1702,7 @@ describe Ci::CreatePipelineService do expect(pipeline).to be_persisted expect(pipeline.builds).to be_empty expect(pipeline.yaml_errors).to eq("test_a: needs 'build_a'") + expect(pipeline.messages.pluck(:content)).to contain_exactly("test_a: needs 'build_a'") expect(pipeline.errors[:base]).to contain_exactly("test_a: needs 'build_a'") end end @@ -1706,6 +1714,7 @@ describe Ci::CreatePipelineService do expect(pipeline).not_to be_persisted expect(pipeline.builds).to be_empty expect(pipeline.yaml_errors).to be_nil + expect(pipeline.messages).not_to be_empty expect(pipeline.errors[:base]).to contain_exactly("test_a: needs 'build_a'") end end @@ -2205,6 +2214,83 @@ describe Ci::CreatePipelineService do expect(find_job('job-7').when).to eq('on_failure') end end + + context 'with deploy freeze period `if:` clause' do + # '0 23 * * 5' == "At 23:00 on Friday."", '0 7 * * 1' == "At 07:00 on Monday."" + let!(:freeze_period) { create(:ci_freeze_period, project: project, freeze_start: '0 23 * * 5', freeze_end: '0 7 * * 1') } + + context 'with 2 jobs' do + let(:config) do + <<-EOY + stages: + - test + - deploy + + test-job: + script: + - echo 'running TEST stage' + + deploy-job: + stage: deploy + script: + - echo 'running DEPLOY stage' + rules: + - if: $CI_DEPLOY_FREEZE == null + EOY + end + + context 'when outside freeze period' do + it 'creates two jobs' do + Timecop.freeze(2020, 4, 10, 22, 59) do + expect(pipeline).to be_persisted + expect(build_names).to contain_exactly('test-job', 'deploy-job') + end + end + end + + context 'when inside freeze period' do + it 'creates one job' do + Timecop.freeze(2020, 4, 10, 23, 1) do + expect(pipeline).to be_persisted + expect(build_names).to contain_exactly('test-job') + end + end + end + end + + context 'with 1 job' do + let(:config) do + <<-EOY + stages: + - deploy + + deploy-job: + stage: deploy + script: + - echo 'running DEPLOY stage' + rules: + - if: $CI_DEPLOY_FREEZE == null + EOY + end + + context 'when outside freeze period' do + it 'creates two jobs' do + Timecop.freeze(2020, 4, 10, 22, 59) do + expect(pipeline).to be_persisted + expect(build_names).to contain_exactly('deploy-job') + end + end + end + + context 'when inside freeze period' do + it 'does not create the pipeline' do + Timecop.freeze(2020, 4, 10, 23, 1) do + expect(pipeline).not_to be_persisted + end + end + end + end + end end end diff --git a/spec/services/ci/create_web_ide_terminal_service_spec.rb b/spec/services/ci/create_web_ide_terminal_service_spec.rb index 2cc67c7cd1d..c1c94e30018 100644 --- a/spec/services/ci/create_web_ide_terminal_service_spec.rb +++ b/spec/services/ci/create_web_ide_terminal_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::CreateWebIdeTerminalService do +RSpec.describe Ci::CreateWebIdeTerminalService do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } let(:ref) { 'master' } diff --git a/spec/services/ci/daily_build_group_report_result_service_spec.rb b/spec/services/ci/daily_build_group_report_result_service_spec.rb index f0b72b8fd86..7d181a5c2ba 100644 --- a/spec/services/ci/daily_build_group_report_result_service_spec.rb +++ b/spec/services/ci/daily_build_group_report_result_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::DailyBuildGroupReportResultService, '#execute' do +RSpec.describe Ci::DailyBuildGroupReportResultService, '#execute' do let!(:pipeline) { create(:ci_pipeline, created_at: '2020-02-06 00:01:10') } let!(:rspec_job) { create(:ci_build, pipeline: pipeline, name: '3/3 rspec', coverage: 80) } let!(:karma_job) { create(:ci_build, pipeline: pipeline, name: '2/2 karma', coverage: 90) } diff --git a/spec/services/ci/destroy_expired_job_artifacts_service_spec.rb b/spec/services/ci/destroy_expired_job_artifacts_service_spec.rb index 4b9f12d8fdf..79443f16276 100644 --- a/spec/services/ci/destroy_expired_job_artifacts_service_spec.rb +++ b/spec/services/ci/destroy_expired_job_artifacts_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::DestroyExpiredJobArtifactsService, :clean_gitlab_redis_shared_state do +RSpec.describe Ci::DestroyExpiredJobArtifactsService, :clean_gitlab_redis_shared_state do include ExclusiveLeaseHelpers describe '.execute' do @@ -14,7 +14,7 @@ describe Ci::DestroyExpiredJobArtifactsService, :clean_gitlab_redis_shared_state context 'when artifact is expired' do context 'when artifact is not locked' do before do - artifact.update!(locked: false) + artifact.job.pipeline.unlocked! end it 'destroys job artifact' do @@ -24,7 +24,7 @@ describe Ci::DestroyExpiredJobArtifactsService, :clean_gitlab_redis_shared_state context 'when artifact is locked' do before do - artifact.update!(locked: true) + artifact.job.pipeline.artifacts_locked! end it 'does not destroy job artifact' do diff --git a/spec/services/ci/destroy_pipeline_service_spec.rb b/spec/services/ci/destroy_pipeline_service_spec.rb index bff2b3179fb..23cbe683d2f 100644 --- a/spec/services/ci/destroy_pipeline_service_spec.rb +++ b/spec/services/ci/destroy_pipeline_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ::Ci::DestroyPipelineService do +RSpec.describe ::Ci::DestroyPipelineService do let(:project) { create(:project, :repository) } let!(:pipeline) { create(:ci_pipeline, :success, project: project, sha: project.commit.id) } diff --git a/spec/services/ci/ensure_stage_service_spec.rb b/spec/services/ci/ensure_stage_service_spec.rb index 8a270d77bae..3ede214cdd4 100644 --- a/spec/services/ci/ensure_stage_service_spec.rb +++ b/spec/services/ci/ensure_stage_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::EnsureStageService, '#execute' do +RSpec.describe Ci::EnsureStageService, '#execute' do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } diff --git a/spec/services/ci/expire_pipeline_cache_service_spec.rb b/spec/services/ci/expire_pipeline_cache_service_spec.rb index 2962e9dd31e..b5d664947de 100644 --- a/spec/services/ci/expire_pipeline_cache_service_spec.rb +++ b/spec/services/ci/expire_pipeline_cache_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::ExpirePipelineCacheService do +RSpec.describe Ci::ExpirePipelineCacheService do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } let_it_be(:pipeline) { create(:ci_pipeline, project: project) } diff --git a/spec/services/ci/external_pull_requests/create_pipeline_service_spec.rb b/spec/services/ci/external_pull_requests/create_pipeline_service_spec.rb index 5048f2b71b3..e2bdfae27f0 100644 --- a/spec/services/ci/external_pull_requests/create_pipeline_service_spec.rb +++ b/spec/services/ci/external_pull_requests/create_pipeline_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::ExternalPullRequests::CreatePipelineService do +RSpec.describe Ci::ExternalPullRequests::CreatePipelineService do describe '#execute' do let_it_be(:project) { create(:project, :auto_devops, :repository) } let_it_be(:user) { create(:user) } diff --git a/spec/services/ci/extract_sections_from_build_trace_service_spec.rb b/spec/services/ci/extract_sections_from_build_trace_service_spec.rb index 03c67c611fe..c6ffcdcc6a8 100644 --- a/spec/services/ci/extract_sections_from_build_trace_service_spec.rb +++ b/spec/services/ci/extract_sections_from_build_trace_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::ExtractSectionsFromBuildTraceService, '#execute' do +RSpec.describe Ci::ExtractSectionsFromBuildTraceService, '#execute' do let(:user) { create(:user) } let(:project) { create(:project) } let(:build) { create(:ci_build, project: project) } diff --git a/spec/services/ci/find_exposed_artifacts_service_spec.rb b/spec/services/ci/find_exposed_artifacts_service_spec.rb index 16e23253c34..287f5c4b929 100644 --- a/spec/services/ci/find_exposed_artifacts_service_spec.rb +++ b/spec/services/ci/find_exposed_artifacts_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::FindExposedArtifactsService do +RSpec.describe Ci::FindExposedArtifactsService do include Gitlab::Routing let(:metadata) do diff --git a/spec/services/ci/generate_coverage_reports_service_spec.rb b/spec/services/ci/generate_coverage_reports_service_spec.rb index b64b682a00b..a3ed2eec713 100644 --- a/spec/services/ci/generate_coverage_reports_service_spec.rb +++ b/spec/services/ci/generate_coverage_reports_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::GenerateCoverageReportsService do +RSpec.describe Ci::GenerateCoverageReportsService do let(:service) { described_class.new(project) } let(:project) { create(:project, :repository) } diff --git a/spec/services/ci/generate_terraform_reports_service_spec.rb b/spec/services/ci/generate_terraform_reports_service_spec.rb index 008ecf17b3e..25bf96035b2 100644 --- a/spec/services/ci/generate_terraform_reports_service_spec.rb +++ b/spec/services/ci/generate_terraform_reports_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::GenerateTerraformReportsService do +RSpec.describe Ci::GenerateTerraformReportsService do let_it_be(:project) { create(:project, :repository) } describe '#execute' do @@ -33,19 +33,36 @@ describe Ci::GenerateTerraformReportsService do end context 'when head pipeline has corrupted terraform reports' do - it 'returns status and error message' do + it 'returns a report with error messages' do build = create(:ci_build, pipeline: merge_request.head_pipeline, project: project) create(:ci_job_artifact, :terraform_with_corrupted_data, job: build, project: project) result = subject.execute(nil, merge_request.head_pipeline) expect(result).to match( - status: :error, - status_reason: 'An error occurred while fetching terraform reports.', + status: :parsed, + data: match( + a_hash_including(build.id.to_s => hash_including( + 'tf_report_error' => :invalid_json_format + )) + ), key: an_instance_of(Array) ) end end + + context 'when head pipeline is corrupted' do + it 'returns status and error message' do + result = subject.execute(nil, nil) + + expect(result).to match( + a_hash_including( + status: :error, + status_reason: 'An error occurred while fetching terraform reports.' + ) + ) + end + end end describe '#latest?' do diff --git a/spec/services/ci/parse_dotenv_artifact_service_spec.rb b/spec/services/ci/parse_dotenv_artifact_service_spec.rb index fc4131d262b..a5f01187a83 100644 --- a/spec/services/ci/parse_dotenv_artifact_service_spec.rb +++ b/spec/services/ci/parse_dotenv_artifact_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::ParseDotenvArtifactService do +RSpec.describe Ci::ParseDotenvArtifactService do let_it_be(:project) { create(:project) } let_it_be(:pipeline) { create(:ci_pipeline, project: project) } let(:build) { create(:ci_build, pipeline: pipeline, project: project) } diff --git a/spec/services/ci/pipeline_bridge_status_service_spec.rb b/spec/services/ci/pipeline_bridge_status_service_spec.rb index 7e79d222349..584b23bb3aa 100644 --- a/spec/services/ci/pipeline_bridge_status_service_spec.rb +++ b/spec/services/ci/pipeline_bridge_status_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::PipelineBridgeStatusService do +RSpec.describe Ci::PipelineBridgeStatusService do let(:user) { build(:user) } let_it_be(:project) { create(:project) } let(:pipeline) { build(:ci_pipeline, project: project) } diff --git a/spec/services/ci/pipeline_processing/atomic_processing_service/status_collection_spec.rb b/spec/services/ci/pipeline_processing/atomic_processing_service/status_collection_spec.rb index de3c7713ac8..7868629d34d 100644 --- a/spec/services/ci/pipeline_processing/atomic_processing_service/status_collection_spec.rb +++ b/spec/services/ci/pipeline_processing/atomic_processing_service/status_collection_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::PipelineProcessing::AtomicProcessingService::StatusCollection do +RSpec.describe Ci::PipelineProcessing::AtomicProcessingService::StatusCollection do using RSpec::Parameterized::TableSyntax let_it_be(:pipeline) { create(:ci_pipeline) } diff --git a/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb b/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb index 3b66ecff196..a10a333b462 100644 --- a/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb +++ b/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_relative 'shared_processing_service.rb' require_relative 'shared_processing_service_tests_with_yaml.rb' -describe Ci::PipelineProcessing::AtomicProcessingService do +RSpec.describe Ci::PipelineProcessing::AtomicProcessingService do before do stub_feature_flags(ci_atomic_processing: true) diff --git a/spec/services/ci/pipeline_processing/legacy_processing_service_spec.rb b/spec/services/ci/pipeline_processing/legacy_processing_service_spec.rb index fd491bf461b..569a6d62dc1 100644 --- a/spec/services/ci/pipeline_processing/legacy_processing_service_spec.rb +++ b/spec/services/ci/pipeline_processing/legacy_processing_service_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_relative 'shared_processing_service.rb' require_relative 'shared_processing_service_tests_with_yaml.rb' -describe Ci::PipelineProcessing::LegacyProcessingService do +RSpec.describe Ci::PipelineProcessing::LegacyProcessingService do before do stub_feature_flags(ci_atomic_processing: false) end diff --git a/spec/services/ci/pipeline_processing/shared_processing_service.rb b/spec/services/ci/pipeline_processing/shared_processing_service.rb index 29fa43001ae..224066885b6 100644 --- a/spec/services/ci/pipeline_processing/shared_processing_service.rb +++ b/spec/services/ci/pipeline_processing/shared_processing_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -shared_examples 'Pipeline Processing Service' do +RSpec.shared_examples 'Pipeline Processing Service' do let(:user) { create(:user) } let(:project) { create(:project) } diff --git a/spec/services/ci/pipeline_processing/shared_processing_service_tests_with_yaml.rb b/spec/services/ci/pipeline_processing/shared_processing_service_tests_with_yaml.rb index 93f83f0ea3b..17d254ba48e 100644 --- a/spec/services/ci/pipeline_processing/shared_processing_service_tests_with_yaml.rb +++ b/spec/services/ci/pipeline_processing/shared_processing_service_tests_with_yaml.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -shared_context 'Pipeline Processing Service Tests With Yaml' do +RSpec.shared_context 'Pipeline Processing Service Tests With Yaml' do where(:test_file_path) do Dir.glob(Rails.root.join('spec/services/ci/pipeline_processing/test_cases/*.yml')) end diff --git a/spec/services/ci/pipeline_schedule_service_spec.rb b/spec/services/ci/pipeline_schedule_service_spec.rb index 867ed0acc0d..65bbd13c5e7 100644 --- a/spec/services/ci/pipeline_schedule_service_spec.rb +++ b/spec/services/ci/pipeline_schedule_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::PipelineScheduleService do +RSpec.describe Ci::PipelineScheduleService do let(:project) { create(:project) } let(:user) { create(:user) } let(:service) { described_class.new(project, user) } diff --git a/spec/services/ci/pipeline_trigger_service_spec.rb b/spec/services/ci/pipeline_trigger_service_spec.rb index 44ce1ff699b..18fab9623ec 100644 --- a/spec/services/ci/pipeline_trigger_service_spec.rb +++ b/spec/services/ci/pipeline_trigger_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::PipelineTriggerService do +RSpec.describe Ci::PipelineTriggerService do let(:project) { create(:project, :repository) } before do diff --git a/spec/services/ci/play_build_service_spec.rb b/spec/services/ci/play_build_service_spec.rb index cf39f3da4fe..c9ecbad3167 100644 --- a/spec/services/ci/play_build_service_spec.rb +++ b/spec/services/ci/play_build_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::PlayBuildService, '#execute' do +RSpec.describe Ci::PlayBuildService, '#execute' do let(:user) { create(:user, developer_projects: [project]) } let(:project) { create(:project) } let(:pipeline) { create(:ci_pipeline, project: project) } diff --git a/spec/services/ci/play_manual_stage_service_spec.rb b/spec/services/ci/play_manual_stage_service_spec.rb index e2946111a13..e30ec8bfda5 100644 --- a/spec/services/ci/play_manual_stage_service_spec.rb +++ b/spec/services/ci/play_manual_stage_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::PlayManualStageService, '#execute' do +RSpec.describe Ci::PlayManualStageService, '#execute' do let(:current_user) { create(:user) } let(:pipeline) { create(:ci_pipeline, user: current_user) } let(:project) { pipeline.project } diff --git a/spec/services/ci/prepare_build_service_spec.rb b/spec/services/ci/prepare_build_service_spec.rb index 02928b58ff8..f75cb322fe9 100644 --- a/spec/services/ci/prepare_build_service_spec.rb +++ b/spec/services/ci/prepare_build_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::PrepareBuildService do +RSpec.describe Ci::PrepareBuildService do describe '#execute' do let(:build) { create(:ci_build, :preparing) } diff --git a/spec/services/ci/process_build_service_spec.rb b/spec/services/ci/process_build_service_spec.rb index abc5c18a523..a6e8732f5ff 100644 --- a/spec/services/ci/process_build_service_spec.rb +++ b/spec/services/ci/process_build_service_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -describe Ci::ProcessBuildService, '#execute' do +RSpec.describe Ci::ProcessBuildService, '#execute' do let(:user) { create(:user) } let(:project) { create(:project) } diff --git a/spec/services/ci/process_pipeline_service_spec.rb b/spec/services/ci/process_pipeline_service_spec.rb index 40ae1c4029b..a7889f0644d 100644 --- a/spec/services/ci/process_pipeline_service_spec.rb +++ b/spec/services/ci/process_pipeline_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::ProcessPipelineService do +RSpec.describe Ci::ProcessPipelineService do let(:user) { create(:user) } let(:project) { create(:project) } @@ -10,38 +10,52 @@ describe Ci::ProcessPipelineService do create(:ci_empty_pipeline, ref: 'master', project: project) end + subject { described_class.new(pipeline) } + before do stub_ci_pipeline_to_return_yaml_file - stub_not_protect_default_branch project.add_developer(user) end - context 'updates a list of retried builds' do - subject { described_class.retried.order(:id) } + describe 'processing events counter' do + let(:metrics) { double('pipeline metrics') } + let(:counter) { double('events counter') } + + before do + allow(subject) + .to receive(:metrics).and_return(metrics) + allow(metrics) + .to receive(:pipeline_processing_events_counter) + .and_return(counter) + end + + it 'increments processing events counter' do + expect(counter).to receive(:increment) + + subject.execute + end + end + describe 'updating a list of retried builds' do let!(:build_retried) { create_build('build') } let!(:build) { create_build('build') } let!(:test) { create_build('test') } it 'returns unique statuses' do - process_pipeline + subject.execute expect(all_builds.latest).to contain_exactly(build, test) expect(all_builds.retried).to contain_exactly(build_retried) end - end - - def process_pipeline - described_class.new(pipeline).execute - end - def create_build(name, **opts) - create(:ci_build, :created, pipeline: pipeline, name: name, **opts) - end + def create_build(name, **opts) + create(:ci_build, :created, pipeline: pipeline, name: name, **opts) + end - def all_builds - pipeline.builds.order(:stage_idx, :id) + def all_builds + pipeline.builds.order(:stage_idx, :id) + end end end diff --git a/spec/services/ci/register_job_service_spec.rb b/spec/services/ci/register_job_service_spec.rb index c0f854df9b7..921f5ba4c7e 100644 --- a/spec/services/ci/register_job_service_spec.rb +++ b/spec/services/ci/register_job_service_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' module Ci - describe RegisterJobService do + RSpec.describe RegisterJobService do let_it_be(:group) { create(:group) } let_it_be(:project, reload: true) { create(:project, group: group, shared_runners_enabled: false, group_runners_enabled: false) } let_it_be(:pipeline) { create(:ci_pipeline, project: project) } @@ -109,12 +109,14 @@ module Ci end context 'shared runner' do - let(:build) { execute(shared_runner) } + let(:response) { described_class.new(shared_runner).execute } + let(:build) { response.build } it { expect(build).to be_kind_of(Build) } it { expect(build).to be_valid } it { expect(build).to be_running } it { expect(build.runner).to eq(shared_runner) } + it { expect(Gitlab::Json.parse(response.build_json)['id']).to eq(build.id) } end context 'specific runner' do @@ -356,13 +358,8 @@ module Ci end context 'runner feature set is verified' do - let!(:pending_job) { create(:ci_build, :pending, pipeline: pipeline) } - - before do - expect_any_instance_of(Ci::Build).to receive(:runner_required_feature_names) do - [:runner_required_feature] - end - end + let(:options) { { artifacts: { reports: { junit: "junit.xml" } } } } + let!(:pending_job) { create(:ci_build, :pending, pipeline: pipeline, options: options) } subject { execute(specific_runner, params) } @@ -378,7 +375,7 @@ module Ci context 'when feature is supported by runner' do let(:params) do - { info: { features: { runner_required_feature: true } } } + { info: { features: { upload_multiple_artifacts: true } } } end it 'does pick job' do diff --git a/spec/services/ci/resource_groups/assign_resource_from_resource_group_service_spec.rb b/spec/services/ci/resource_groups/assign_resource_from_resource_group_service_spec.rb index 50d312647ae..6c69a7f3b11 100644 --- a/spec/services/ci/resource_groups/assign_resource_from_resource_group_service_spec.rb +++ b/spec/services/ci/resource_groups/assign_resource_from_resource_group_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::ResourceGroups::AssignResourceFromResourceGroupService do +RSpec.describe Ci::ResourceGroups::AssignResourceFromResourceGroupService do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } let(:service) { described_class.new(project, user) } diff --git a/spec/services/ci/retry_build_service_spec.rb b/spec/services/ci/retry_build_service_spec.rb index 90c53d4a346..5a245415b32 100644 --- a/spec/services/ci/retry_build_service_spec.rb +++ b/spec/services/ci/retry_build_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::RetryBuildService do +RSpec.describe Ci::RetryBuildService do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :repository) } let_it_be(:pipeline) do @@ -33,13 +33,13 @@ describe Ci::RetryBuildService do job_artifacts_sast job_artifacts_secret_detection job_artifacts_dependency_scanning job_artifacts_container_scanning job_artifacts_dast job_artifacts_license_management job_artifacts_license_scanning - job_artifacts_performance job_artifacts_lsif - job_artifacts_terraform job_artifacts_cluster_applications + job_artifacts_performance job_artifacts_browser_performance job_artifacts_load_performance + job_artifacts_lsif job_artifacts_terraform job_artifacts_cluster_applications job_artifacts_codequality job_artifacts_metrics scheduled_at job_variables waiting_for_resource_at job_artifacts_metrics_referee job_artifacts_network_referee job_artifacts_dotenv job_artifacts_cobertura needs job_artifacts_accessibility - job_artifacts_requirements].freeze + job_artifacts_requirements job_artifacts_coverage_fuzzing].freeze ignore_accessors = %i[type lock_version target_url base_tags trace_sections @@ -279,25 +279,16 @@ describe Ci::RetryBuildService do end end - context 'when scheduling_type of build is nil' do + context 'when build has needs' do before do - build.update_columns(scheduling_type: nil) + create(:ci_build_need, build: build, name: 'build1') + create(:ci_build_need, build: build, name: 'build2') end - context 'when build has not needs' do - it 'sets scheduling_type as :stage' do - expect(new_build.scheduling_type).to eq('stage') - end - end + it 'bulk inserts all needs' do + expect(Ci::BuildNeed).to receive(:bulk_insert!).and_call_original - context 'when build has needs' do - before do - create(:ci_build_need, build: build) - end - - it 'sets scheduling_type as :dag' do - expect(new_build.scheduling_type).to eq('dag') - end + new_build end end end diff --git a/spec/services/ci/retry_pipeline_service_spec.rb b/spec/services/ci/retry_pipeline_service_spec.rb index 8e85e68d4fc..fa46d6c4d1d 100644 --- a/spec/services/ci/retry_pipeline_service_spec.rb +++ b/spec/services/ci/retry_pipeline_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::RetryPipelineService, '#execute' do +RSpec.describe Ci::RetryPipelineService, '#execute' do include ProjectForksHelper let(:user) { create(:user) } diff --git a/spec/services/ci/run_scheduled_build_service_spec.rb b/spec/services/ci/run_scheduled_build_service_spec.rb index 43d110cbc8f..27d25e88944 100644 --- a/spec/services/ci/run_scheduled_build_service_spec.rb +++ b/spec/services/ci/run_scheduled_build_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::RunScheduledBuildService do +RSpec.describe Ci::RunScheduledBuildService do let(:user) { create(:user) } let(:project) { create(:project) } let(:pipeline) { create(:ci_pipeline, project: project) } diff --git a/spec/services/ci/stop_environments_service_spec.rb b/spec/services/ci/stop_environments_service_spec.rb index ebbe6c37b87..5a0b7f23556 100644 --- a/spec/services/ci/stop_environments_service_spec.rb +++ b/spec/services/ci/stop_environments_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::StopEnvironmentsService do +RSpec.describe Ci::StopEnvironmentsService do include CreateEnvironmentsHelpers let(:project) { create(:project, :private, :repository) } diff --git a/spec/services/ci/unlock_artifacts_service_spec.rb b/spec/services/ci/unlock_artifacts_service_spec.rb new file mode 100644 index 00000000000..8d289a867ba --- /dev/null +++ b/spec/services/ci/unlock_artifacts_service_spec.rb @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Ci::UnlockArtifactsService do + describe '#execute' do + subject(:execute) { described_class.new(pipeline.project, pipeline.user).execute(ci_ref, before_pipeline) } + + before do + stub_const("#{described_class}::BATCH_SIZE", 1) + end + + [true, false].each do |tag| + context "when tag is #{tag}" do + let(:ref) { 'master' } + let(:ref_path) { tag ? "#{::Gitlab::Git::TAG_REF_PREFIX}#{ref}" : "#{::Gitlab::Git::BRANCH_REF_PREFIX}#{ref}" } + let(:ci_ref) { create(:ci_ref, ref_path: ref_path) } + + let!(:old_unlocked_pipeline) { create(:ci_pipeline, ref: ref, tag: tag, project: ci_ref.project, locked: :unlocked) } + let!(:older_pipeline) { create(:ci_pipeline, ref: ref, tag: tag, project: ci_ref.project, locked: :artifacts_locked) } + let!(:older_ambiguous_pipeline) { create(:ci_pipeline, ref: ref, tag: !tag, project: ci_ref.project, locked: :artifacts_locked) } + let!(:pipeline) { create(:ci_pipeline, ref: ref, tag: tag, project: ci_ref.project, locked: :artifacts_locked) } + let!(:child_pipeline) { create(:ci_pipeline, ref: ref, tag: tag, project: ci_ref.project, locked: :artifacts_locked) } + let!(:newer_pipeline) { create(:ci_pipeline, ref: ref, tag: tag, project: ci_ref.project, locked: :artifacts_locked) } + let!(:other_ref_pipeline) { create(:ci_pipeline, ref: 'other_ref', tag: tag, project: ci_ref.project, locked: :artifacts_locked) } + + before do + create(:ci_sources_pipeline, + source_job: create(:ci_build, pipeline: pipeline), + source_project: ci_ref.project, + pipeline: child_pipeline, + project: ci_ref.project) + end + + context 'when running on a ref before a pipeline' do + let(:before_pipeline) { pipeline } + + it 'unlocks artifacts from older pipelines' do + expect { execute }.to change { older_pipeline.reload.locked }.from('artifacts_locked').to('unlocked') + end + + it 'does not unlock artifacts for tag or branch with same name as ref' do + expect { execute }.not_to change { older_ambiguous_pipeline.reload.locked }.from('artifacts_locked') + end + + it 'does not unlock artifacts from newer pipelines' do + expect { execute }.not_to change { newer_pipeline.reload.locked }.from('artifacts_locked') + end + + it 'does not lock artifacts from old unlocked pipelines' do + expect { execute }.not_to change { old_unlocked_pipeline.reload.locked }.from('unlocked') + end + + it 'does not unlock artifacts from the same pipeline' do + expect { execute }.not_to change { pipeline.reload.locked }.from('artifacts_locked') + end + + it 'does not unlock artifacts for other refs' do + expect { execute }.not_to change { other_ref_pipeline.reload.locked }.from('artifacts_locked') + end + + it 'does not unlock artifacts for child pipeline' do + expect { execute }.not_to change { child_pipeline.reload.locked }.from('artifacts_locked') + end + end + + context 'when running on just the ref' do + let(:before_pipeline) { nil } + + it 'unlocks artifacts from older pipelines' do + expect { execute }.to change { older_pipeline.reload.locked }.from('artifacts_locked').to('unlocked') + end + + it 'unlocks artifacts from newer pipelines' do + expect { execute }.to change { newer_pipeline.reload.locked }.from('artifacts_locked').to('unlocked') + end + + it 'unlocks artifacts from the same pipeline' do + expect { execute }.to change { pipeline.reload.locked }.from('artifacts_locked').to('unlocked') + end + + it 'does not unlock artifacts for tag or branch with same name as ref' do + expect { execute }.not_to change { older_ambiguous_pipeline.reload.locked }.from('artifacts_locked') + end + + it 'does not lock artifacts from old unlocked pipelines' do + expect { execute }.not_to change { old_unlocked_pipeline.reload.locked }.from('unlocked') + end + + it 'does not unlock artifacts for other refs' do + expect { execute }.not_to change { other_ref_pipeline.reload.locked }.from('artifacts_locked') + end + end + end + end + end +end diff --git a/spec/services/ci/update_build_queue_service_spec.rb b/spec/services/ci/update_build_queue_service_spec.rb index 522dd1ba1c2..0f4c0fa5ecb 100644 --- a/spec/services/ci/update_build_queue_service_spec.rb +++ b/spec/services/ci/update_build_queue_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::UpdateBuildQueueService do +RSpec.describe Ci::UpdateBuildQueueService do let(:project) { create(:project, :repository) } let(:build) { create(:ci_build, pipeline: pipeline) } let(:pipeline) { create(:ci_pipeline, project: project) } diff --git a/spec/services/ci/update_instance_variables_service_spec.rb b/spec/services/ci/update_instance_variables_service_spec.rb index 93f6e5d3ea8..f235d006e34 100644 --- a/spec/services/ci/update_instance_variables_service_spec.rb +++ b/spec/services/ci/update_instance_variables_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::UpdateInstanceVariablesService do +RSpec.describe Ci::UpdateInstanceVariablesService do let(:params) { { variables_attributes: variables_attributes } } subject { described_class.new(params) } diff --git a/spec/services/ci/update_runner_service_spec.rb b/spec/services/ci/update_runner_service_spec.rb index abe575eebc8..cad9e893335 100644 --- a/spec/services/ci/update_runner_service_spec.rb +++ b/spec/services/ci/update_runner_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::UpdateRunnerService do +RSpec.describe Ci::UpdateRunnerService do let(:runner) { create(:ci_runner) } describe '#update' do diff --git a/spec/services/ci/web_ide_config_service_spec.rb b/spec/services/ci/web_ide_config_service_spec.rb index 7522103ccb7..437b468cec8 100644 --- a/spec/services/ci/web_ide_config_service_spec.rb +++ b/spec/services/ci/web_ide_config_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::WebIdeConfigService do +RSpec.describe Ci::WebIdeConfigService do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } let(:sha) { 'sha' } |