diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-14 00:09:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-14 00:09:38 +0300 |
commit | 602ea42669779ec431bcaeb41fd95e079b1a7021 (patch) | |
tree | 25e074ca0914fca832b826e200aa0612e45564ec /spec/models/project_services/chat_message | |
parent | 6ce0f44c6b2c2af48c7ef4fef97913d054088deb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/project_services/chat_message')
-rw-r--r-- | spec/models/project_services/chat_message/pipeline_message_spec.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/models/project_services/chat_message/pipeline_message_spec.rb b/spec/models/project_services/chat_message/pipeline_message_spec.rb index 4210b52a8b9..e99148d1d1f 100644 --- a/spec/models/project_services/chat_message/pipeline_message_spec.rb +++ b/spec/models/project_services/chat_message/pipeline_message_spec.rb @@ -431,6 +431,57 @@ describe ChatMessage::PipelineMessage do end end + context "when jobs succeed on retries" do + before do + args[:builds] = [ + { id: 1, name: "job-1", status: "failed", stage: "stage-1" }, + { id: 2, name: "job-2", status: "failed", stage: "stage-2" }, + { id: 3, name: "job-3", status: "failed", stage: "stage-3" }, + { id: 7, name: "job-1", status: "failed", stage: "stage-1" }, + { id: 8, name: "job-1", status: "success", stage: "stage-1" } + ] + end + + it "do not return a job which succeeded on retry" do + expected_jobs = [ + "<http://example.gitlab.com/-/jobs/3|job-3>", + "<http://example.gitlab.com/-/jobs/2|job-2>" + ] + + expect(subject.attachments.first[:fields][3]).to eq( + title: "Failed jobs", + value: expected_jobs.join(", "), + short: true + ) + end + end + + context "when jobs failed even on retries" do + before do + args[:builds] = [ + { id: 1, name: "job-1", status: "failed", stage: "stage-1" }, + { id: 2, name: "job-2", status: "failed", stage: "stage-2" }, + { id: 3, name: "job-3", status: "failed", stage: "stage-3" }, + { id: 7, name: "job-1", status: "failed", stage: "stage-1" }, + { id: 8, name: "job-1", status: "failed", stage: "stage-1" } + ] + end + + it "returns only first instance of the failed job" do + expected_jobs = [ + "<http://example.gitlab.com/-/jobs/3|job-3>", + "<http://example.gitlab.com/-/jobs/2|job-2>", + "<http://example.gitlab.com/-/jobs/1|job-1>" + ] + + expect(subject.attachments.first[:fields][3]).to eq( + title: "Failed jobs", + value: expected_jobs.join(", "), + short: true + ) + end + end + context "when the CI config file contains a YAML error" do let(:has_yaml_errors) { true } |