diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-09-07 17:14:07 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-09-07 17:14:07 +0300 |
commit | c5377b97968ba9edefe7766dac77cc9fbbaa4e2c (patch) | |
tree | d7831a702d7cd7510075572f77d6a561ab2eed6a /spec | |
parent | f946558bb3b4ba6ff67a8c306af249b8d5350f39 (diff) |
Finished internal_id2. But this should be done by transaction
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/import_export/safe_model_attributes.yml | 1 | ||||
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/ci/create_pipeline_service_spec.rb | 12 |
3 files changed, 14 insertions, 1 deletions
diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml index 122b8ee0314..2f0723b658f 100644 --- a/spec/lib/gitlab/import_export/safe_model_attributes.yml +++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml @@ -206,6 +206,7 @@ MergeRequestDiffFile: - binary Ci::Pipeline: - id +- iid - project_id - source - ref diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 8616d44fe44..2e517d05161 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -183,7 +183,7 @@ describe Ci::Pipeline, :mailer do it 'includes the defined keys' do keys = subject.map { |v| v[:key] } - expect(keys).to eq(['CI_PIPELINE_ID', 'CI_PIPELINE_IID', 'CI_CONFIG_PATH', 'CI_PIPELINE_SOURCE']) + expect(keys).to eq(%w[CI_PIPELINE_ID CI_PIPELINE_IID CI_CONFIG_PATH CI_PIPELINE_SOURCE]) end context 'when iid is nil' do diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index c74d2d1da84..c609f5029a8 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -481,6 +481,18 @@ describe Ci::CreatePipelineService do end end end + + context 'when failed to set_iid' do + before do + allow_any_instance_of(Ci::Pipeline).to receive(:set_iid).and_raise(InternalId2::FailedToSaveInternalIdError) + end + + let(:pipeline) { execute_service } + + it 'does not create a new pipeline' do + expect(pipeline).not_to be_persisted + end + end end describe '#allowed_to_create?' do |