Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'suppress-allow-failure-builds' into 'master'
Suppress e-mails on failed builds if allow_failure is set Every time I push to GitLab, I get > 2 emails saying a spec failed when I don't care about the benchmarks and others that have `allow_failure` set to `true`. @ayufan mentioned creating a summary e-mail to prevent getting one e-mail per build, but the latter might actually be desirable. For example, I do want to know if Rubocop errors fail right away. See merge request !2178
- Loading branch information
Showing
5 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'spec_helper' | ||
|
||
describe BuildsEmailService do | ||
let(:build) { create(:ci_build) } | ||
let(:data) { Gitlab::BuildDataBuilder.build(build) } | ||
let(:service) { BuildsEmailService.new } | ||
|
||
describe :execute do | ||
it "sends email" do | ||
service.recipients = 'test@gitlab.com' | ||
data[:build_status] = 'failed' | ||
expect(BuildEmailWorker).to receive(:perform_async) | ||
service.execute(data) | ||
end | ||
|
||
it "does not sends email with failed build and allowed_failure on" do | ||
data[:build_status] = 'failed' | ||
data[:build_allow_failure] = true | ||
expect(BuildEmailWorker).not_to receive(:perform_async) | ||
service.execute(data) | ||
end | ||
end | ||
end |