diff options
author | Stan Hu <stanhu@gmail.com> | 2019-09-03 23:34:52 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-09-05 21:42:14 -0700 |
commit | c34240d26fdcf447ee86172a81c0fc56fcaf9cbc (patch) | |
tree | f1d74946d5725d2df09c5845f76debc5851adc36 /spec | |
parent | 13227500f29d8a74c77cba23b7dfdb4169222821 (diff) | |
download | gitlab-ce-c34240d26fdcf447ee86172a81c0fc56fcaf9cbc.tar.gz |
Log errors for failed pipeline creation in PostReceivesh-add-sidekiq-logging-for-bad-ci
When a pipeline fails to create in `PostReceive`, the error is silently
discarded, making it difficult to understand why a pipeline was not
created. We now add a Sidekiq warning message for this. Adding a Sentry
exception when this happens would generate a lot of noise for invalid CI
files.
Relates to https://gitlab.com/gitlab-org/gitlab-ee/issues/14720
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/git/branch_push_service_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/services/git/branch_push_service_spec.rb b/spec/services/git/branch_push_service_spec.rb index d9e607cd251..c3a4f3dbe3f 100644 --- a/spec/services/git/branch_push_service_spec.rb +++ b/spec/services/git/branch_push_service_spec.rb @@ -99,6 +99,20 @@ describe Git::BranchPushService, services: true do expect(pipeline).to be_push expect(Gitlab::Git::BRANCH_REF_PREFIX + pipeline.ref).to eq(ref) end + + context 'when pipeline has errors' do + before do + config = YAML.dump({ test: { script: 'ls', only: ['feature'] } }) + stub_ci_pipeline_yaml_file(config) + end + + it 'reports an error' do + allow(Sidekiq).to receive(:server?).and_return(true) + expect(Sidekiq.logger).to receive(:warn) + + expect { subject }.not_to change { Ci::Pipeline.count } + end + end end describe "Updates merge requests" do |