diff options
author | Matija Čupić <matteeyah@gmail.com> | 2019-07-11 21:13:32 +0200 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2019-07-27 00:00:04 +0200 |
commit | 4213e4d3ccdc3c5bdf63393fb652842d9a6fb2cb (patch) | |
tree | 67d73d00f7be6de87355391c783ced616f84d9eb | |
parent | 55e724736fceff1e626d145592cd1e95c40cac96 (diff) | |
download | gitlab-ce-4213e4d3ccdc3c5bdf63393fb652842d9a6fb2cb.tar.gz |
Update build retry spec to reject job_variables
-rw-r--r-- | spec/models/ci/build_spec.rb | 13 | ||||
-rw-r--r-- | spec/services/ci/retry_build_service_spec.rb | 5 |
2 files changed, 9 insertions, 9 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index d30b320e3d1..17c7c05324a 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -22,7 +22,7 @@ describe Ci::Build do it { is_expected.to have_many(:trace_sections)} it { is_expected.to have_one(:deployment) } it { is_expected.to have_one(:runner_session) } - it { is_expected.to have_many(:variables) } + it { is_expected.to have_many(:job_variables) } it { is_expected.to validate_presence_of(:ref) } it { is_expected.to respond_to(:has_trace?) } it { is_expected.to respond_to(:trace) } @@ -2259,17 +2259,14 @@ describe Ci::Build do it { is_expected.to include(manual_variable) } end - context 'when job variables are present' do - let(:job_variables) do - [{ key: 'first', value: 'first' }, - { key: 'second', value: 'second' }] - end + context 'when job variable is defined' do + let(:job_variable) { { key: 'first', value: 'first', public: false, masked: false } } before do - build.update(job_variables_attributes: job_variables) + create(:ci_job_variable, job_variable.slice(:key, :value).merge(job: build)) end - it { is_expected.to include(job_variables) } + it { is_expected.to include(job_variable) } end context 'when build is for tag' do diff --git a/spec/services/ci/retry_build_service_spec.rb b/spec/services/ci/retry_build_service_spec.rb index 11b06ef5019..915288cd916 100644 --- a/spec/services/ci/retry_build_service_spec.rb +++ b/spec/services/ci/retry_build_service_spec.rb @@ -30,7 +30,8 @@ describe Ci::RetryBuildService do job_artifacts_sast job_artifacts_dependency_scanning job_artifacts_container_scanning job_artifacts_dast job_artifacts_license_management job_artifacts_performance - job_artifacts_codequality job_artifacts_metrics scheduled_at].freeze + job_artifacts_codequality job_artifacts_metrics scheduled_at + job_variables].freeze IGNORE_ACCESSORS = %i[type lock_version target_url base_tags trace_sections @@ -65,6 +66,8 @@ describe Ci::RetryBuildService do file_type: file_type, job: build, expire_at: build.artifacts_expire_at) end + create(:ci_job_variable, job: build) + build.reload end |