diff options
Diffstat (limited to 'spec/lib/gitlab/ci/templates/Jobs')
-rw-r--r-- | spec/lib/gitlab/ci/templates/Jobs/build_gitlab_ci_yaml_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/templates/Jobs/sast_iac_latest_gitlab_ci_yaml_spec.rb | 34 |
2 files changed, 21 insertions, 15 deletions
diff --git a/spec/lib/gitlab/ci/templates/Jobs/build_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/Jobs/build_gitlab_ci_yaml_spec.rb index 07cfa939623..995922b6922 100644 --- a/spec/lib/gitlab/ci/templates/Jobs/build_gitlab_ci_yaml_spec.rb +++ b/spec/lib/gitlab/ci/templates/Jobs/build_gitlab_ci_yaml_spec.rb @@ -10,7 +10,7 @@ RSpec.describe 'Jobs/Build.gitlab-ci.yml' do describe 'AUTO_BUILD_IMAGE_VERSION' do it 'corresponds to a published image in the registry' do registry = "https://#{template_registry_host}" - repository = "gitlab-org/cluster-integration/auto-build-image" + repository = auto_build_image_repository reference = YAML.safe_load(template.content).dig('variables', 'AUTO_BUILD_IMAGE_VERSION') expect(public_image_exist?(registry, repository, reference)).to be true diff --git a/spec/lib/gitlab/ci/templates/Jobs/sast_iac_latest_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/Jobs/sast_iac_latest_gitlab_ci_yaml_spec.rb index 039a6a739dd..2b9213ea921 100644 --- a/spec/lib/gitlab/ci/templates/Jobs/sast_iac_latest_gitlab_ci_yaml_spec.rb +++ b/spec/lib/gitlab/ci/templates/Jobs/sast_iac_latest_gitlab_ci_yaml_spec.rb @@ -23,27 +23,33 @@ RSpec.describe 'Jobs/SAST-IaC.latest.gitlab-ci.yml', feature_category: :continuo allow(project).to receive(:default_branch).and_return(default_branch) end - context 'on feature branch' do - let(:pipeline_ref) { 'feature' } + context 'when SAST_DISABLED="false"' do + before do + create(:ci_variable, key: 'SAST_DISABLED', value: 'false', project: project) + end + + context 'on feature branch' do + let(:pipeline_ref) { 'feature' } - it 'creates the kics-iac-sast job' do - expect(build_names).to contain_exactly('kics-iac-sast') + it 'creates the kics-iac-sast job' do + expect(build_names).to contain_exactly('kics-iac-sast') + end end - end - context 'on merge request' do - let(:service) { MergeRequests::CreatePipelineService.new(project: project, current_user: user) } - let(:merge_request) { create(:merge_request, :simple, source_project: project) } - let(:pipeline) { service.execute(merge_request).payload } + context 'on merge request' do + let(:service) { MergeRequests::CreatePipelineService.new(project: project, current_user: user) } + let(:merge_request) { create(:merge_request, :simple, source_project: project) } + let(:pipeline) { service.execute(merge_request).payload } - it 'creates a pipeline with the expected jobs' do - expect(pipeline).to be_merge_request_event - expect(pipeline.errors.full_messages).to be_empty - expect(build_names).to match_array(%w(kics-iac-sast)) + it 'creates a pipeline with the expected jobs' do + expect(pipeline).to be_merge_request_event + expect(pipeline.errors.full_messages).to be_empty + expect(build_names).to match_array(%w(kics-iac-sast)) + end end end - context 'SAST_DISABLED is set' do + context 'when SAST_DISABLED="true"' do before do create(:ci_variable, key: 'SAST_DISABLED', value: 'true', project: project) end |