-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): fix duplicate notif for empty pipeline
* test(api): integration test for mail notif Signed-off-by: Yvonnick Esnault <[email protected]>
- Loading branch information
Showing
8 changed files
with
169 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,11 @@ vars: | |
cdsctl.config : './cdsrc' | ||
smtpmock.url: 'http://localhost:2024' | ||
username: cds.integration.tests.rw | ||
ring: | ||
email: [email protected] | ||
fullname: cds.integration.tests.rw | ||
password: "123456&éçà(§" | ||
ring: | ||
smtpmock.url: 'http://localhost:2024' | ||
|
||
|
||
testcases: | ||
- name: Check SMTP mock | ||
|
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,99 @@ | ||
name: Create a simple workflow (04SCWorkflowRunNotif) that use all worker command and run it | ||
version: "2" | ||
|
||
vars : | ||
smtpmock.url: 'http://localhost:2024' | ||
|
||
testcases: | ||
- name: Check SMTP mock | ||
steps: | ||
- type: http | ||
method: GET | ||
url: '{{.smtpmock.url}}' | ||
retry: 5 | ||
delay: 5 | ||
|
||
- name: assert filepath, your current directory must be at the root of this project | ||
steps: | ||
- script: '[ -f ./fixtures/04SCWorkflowRunNotif/pipeline.yml ]' | ||
- script: '[ -f ./fixtures/04SCWorkflowRunNotif/workflow.yml ]' | ||
|
||
- name: prepare test | ||
steps: | ||
- script: "{{.cdsctl}} -f {{.cdsctl.config}} project remove --force 04SCWORKFLOWRUNNOTIF" | ||
- script: "{{.cdsctl}} -f {{.cdsctl.config}} group remove --force 04scworkflowrunnotif" | ||
- script: "{{.cdsctl}} -f {{.cdsctl.config}} project add 04SCWORKFLOWRUNNOTIF 04SCWorkflowRunNotif" | ||
|
||
- name: import pipeline and workflow | ||
steps: | ||
- script: {{.cdsctl}} -f {{.cdsctl.config}} pipeline import --force 04SCWORKFLOWRUNNOTIF ./fixtures/04SCWorkflowRunNotif/pipeline.yml | ||
- script: {{.cdsctl}} -f {{.cdsctl.config}} pipeline import --force 04SCWORKFLOWRUNNOTIF ./fixtures/04SCWorkflowRunNotif/empty.yml | ||
- script: {{.cdsctl}} -f {{.cdsctl.config}} workflow import --force 04SCWORKFLOWRUNNOTIF ./fixtures/04SCWorkflowRunNotif/workflow.yml | ||
- script: {{.cdsctl}} -f {{.cdsctl.config}} workflow import --force 04SCWORKFLOWRUNNOTIF ./fixtures/04SCWorkflowRunNotif/workflow-empty.yml | ||
|
||
- name: run workflow | ||
steps: | ||
- script: {{.cdsctl}} -f {{.cdsctl.config}} workflow run 04SCWORKFLOWRUNNOTIF 04SCWorkflowRunNotif-WORKFLOW | ||
assertions: | ||
- result.code ShouldEqual 0 | ||
- "result.systemout ShouldContainSubstring Workflow 04SCWorkflowRunNotif-WORKFLOW #1 has been launched" | ||
|
||
- name: check workflow | ||
steps: | ||
- script: {{.cdsctl}} -f {{.cdsctl.config}} workflow status 04SCWORKFLOWRUNNOTIF 04SCWorkflowRunNotif-WORKFLOW 1 --format json | ||
retry: 20 | ||
delay: 10 | ||
assertions: | ||
- result.code ShouldEqual 0 | ||
- result.systemoutjson.last_execution ShouldNotBeEmpty | ||
- result.systemoutjson.start ShouldNotBeEmpty | ||
- result.systemoutjson.num ShouldContainSubstring 1 | ||
- result.systemoutjson.status ShouldEqual Success | ||
|
||
- name: check-mail-notif | ||
steps: | ||
- type: http | ||
method: GET | ||
url: '{{.smtpmock.url}}/messages/[email protected]' | ||
assertions: | ||
- result.statuscode ShouldEqual 200 | ||
- result.bodyjson.__len__ ShouldEqual 1 | ||
- type: http | ||
method: GET | ||
url: '{{.smtpmock.url}}/messages/[email protected]/latest' | ||
assertions: | ||
- result.statuscode ShouldEqual 200 | ||
retry: 10 | ||
delay: 3 | ||
vars: | ||
verify: | ||
from: result.bodyjson.content | ||
regex: logcontent:foo2 | ||
|
||
- name: run workflow | ||
steps: | ||
- script: {{.cdsctl}} -f {{.cdsctl.config}} workflow run 04SCWORKFLOWRUNNOTIF 04SCWorkflowRunNotif-WORKFLOW-EMPTY | ||
assertions: | ||
- result.code ShouldEqual 0 | ||
- "result.systemout ShouldContainSubstring Workflow 04SCWorkflowRunNotif-WORKFLOW-EMPTY #1 has been launched" | ||
|
||
- name: check workflow | ||
steps: | ||
- script: {{.cdsctl}} -f {{.cdsctl.config}} workflow status 04SCWORKFLOWRUNNOTIF 04SCWorkflowRunNotif-WORKFLOW-EMPTY 1 --format json | ||
retry: 20 | ||
delay: 10 | ||
assertions: | ||
- result.code ShouldEqual 0 | ||
- result.systemoutjson.last_execution ShouldNotBeEmpty | ||
- result.systemoutjson.start ShouldNotBeEmpty | ||
- result.systemoutjson.num ShouldContainSubstring 1 | ||
- result.systemoutjson.status ShouldEqual Success | ||
|
||
- name: check-mail-notif | ||
steps: | ||
- type: http | ||
method: GET | ||
url: '{{.smtpmock.url}}/messages/[email protected]' | ||
assertions: | ||
- result.statuscode ShouldEqual 200 | ||
- result.bodyjson.__len__ ShouldEqual 1 |
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,2 @@ | ||
version: v1.0 | ||
name: empty |
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,14 @@ | ||
version: v1.0 | ||
name: 04SCWorkflowRunNotif-PIPELINE | ||
stages: | ||
- Stage1 | ||
|
||
jobs: | ||
- job: EXPORT | ||
stage: Stage1 | ||
steps: | ||
- script: | ||
- set -ex | ||
- echo "foo2" >> build.log | ||
- BUILD_LOG=$(cat build.log | tail -n 200 | base64) | ||
- worker export logcontent "$BUILD_LOG" |
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,18 @@ | ||
name: 04SCWorkflowRunNotif-WORKFLOW-EMPTY | ||
version: v2.0 | ||
workflow: | ||
empty: | ||
pipeline: empty | ||
metadata: | ||
default_tags: git.branch,git.author | ||
notifications: | ||
- type: email | ||
pipelines: | ||
- empty | ||
settings: | ||
on_success: always | ||
recipients: | ||
- [email protected] | ||
template: | ||
body: | | ||
foo |
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,20 @@ | ||
name: 04SCWorkflowRunNotif-WORKFLOW | ||
version: v2.0 | ||
workflow: | ||
test-notif: | ||
pipeline: 04SCWorkflowRunNotif-PIPELINE | ||
metadata: | ||
default_tags: git.branch,git.author | ||
notifications: | ||
- type: email | ||
pipelines: | ||
- test-notif | ||
settings: | ||
on_success: always | ||
recipients: | ||
- [email protected] | ||
template: | ||
body: | | ||
title:{{.cds.project}}/{{.cds.workflow}}#{{.cds.version}} {{.cds.status}} | ||
url:{{.cds.buildURL}} | ||
logcontent:{{.cds.build.logcontent | b64dec}} |
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