|
| 1 | +name: Create a simple workflow (04SCWorkflowRunNotif) that use all worker command and run it |
| 2 | +version: "2" |
| 3 | + |
| 4 | +vars : |
| 5 | + smtpmock.url: 'http://localhost:2024' |
| 6 | + |
| 7 | +testcases: |
| 8 | +- name: Check SMTP mock |
| 9 | + steps: |
| 10 | + - type: http |
| 11 | + method: GET |
| 12 | + url: '{{.smtpmock.url}}' |
| 13 | + retry: 5 |
| 14 | + delay: 5 |
| 15 | + |
| 16 | +- name: assert filepath, your current directory must be at the root of this project |
| 17 | + steps: |
| 18 | + - script: '[ -f ./fixtures/04SCWorkflowRunNotif/pipeline.yml ]' |
| 19 | + - script: '[ -f ./fixtures/04SCWorkflowRunNotif/workflow.yml ]' |
| 20 | + |
| 21 | +- name: prepare test |
| 22 | + steps: |
| 23 | + - script: "{{.cdsctl}} -f {{.cdsctl.config}} project remove --force 04SCWORKFLOWRUNNOTIF" |
| 24 | + - script: "{{.cdsctl}} -f {{.cdsctl.config}} group remove --force 04scworkflowrunnotif" |
| 25 | + - script: "{{.cdsctl}} -f {{.cdsctl.config}} project add 04SCWORKFLOWRUNNOTIF 04SCWorkflowRunNotif" |
| 26 | + |
| 27 | +- name: import pipeline and workflow |
| 28 | + steps: |
| 29 | + - script: {{.cdsctl}} -f {{.cdsctl.config}} pipeline import --force 04SCWORKFLOWRUNNOTIF ./fixtures/04SCWorkflowRunNotif/pipeline.yml |
| 30 | + - script: {{.cdsctl}} -f {{.cdsctl.config}} pipeline import --force 04SCWORKFLOWRUNNOTIF ./fixtures/04SCWorkflowRunNotif/empty.yml |
| 31 | + - script: {{.cdsctl}} -f {{.cdsctl.config}} workflow import --force 04SCWORKFLOWRUNNOTIF ./fixtures/04SCWorkflowRunNotif/workflow.yml |
| 32 | + - script: {{.cdsctl}} -f {{.cdsctl.config}} workflow import --force 04SCWORKFLOWRUNNOTIF ./fixtures/04SCWorkflowRunNotif/workflow-empty.yml |
| 33 | + |
| 34 | +- name: run workflow |
| 35 | + steps: |
| 36 | + - script: {{.cdsctl}} -f {{.cdsctl.config}} workflow run 04SCWORKFLOWRUNNOTIF 04SCWorkflowRunNotif-WORKFLOW |
| 37 | + assertions: |
| 38 | + - result.code ShouldEqual 0 |
| 39 | + - "result.systemout ShouldContainSubstring Workflow 04SCWorkflowRunNotif-WORKFLOW #1 has been launched" |
| 40 | + |
| 41 | +- name: check workflow |
| 42 | + steps: |
| 43 | + - script: {{.cdsctl}} -f {{.cdsctl.config}} workflow status 04SCWORKFLOWRUNNOTIF 04SCWorkflowRunNotif-WORKFLOW 1 --format json |
| 44 | + retry: 20 |
| 45 | + delay: 10 |
| 46 | + assertions: |
| 47 | + - result.code ShouldEqual 0 |
| 48 | + - result.systemoutjson.last_execution ShouldNotBeEmpty |
| 49 | + - result.systemoutjson.start ShouldNotBeEmpty |
| 50 | + - result.systemoutjson.num ShouldContainSubstring 1 |
| 51 | + - result.systemoutjson.status ShouldEqual Success |
| 52 | + |
| 53 | +- name: check-mail-notif |
| 54 | + steps: |
| 55 | + - type: http |
| 56 | + method: GET |
| 57 | + url: '{{.smtpmock.url}}/messages/[email protected]' |
| 58 | + assertions: |
| 59 | + - result.statuscode ShouldEqual 200 |
| 60 | + - result.bodyjson.__len__ ShouldEqual 1 |
| 61 | + - type: http |
| 62 | + method: GET |
| 63 | + url: '{{.smtpmock.url}}/messages/[email protected]/latest' |
| 64 | + assertions: |
| 65 | + - result.statuscode ShouldEqual 200 |
| 66 | + retry: 10 |
| 67 | + delay: 3 |
| 68 | + vars: |
| 69 | + verify: |
| 70 | + from: result.bodyjson.content |
| 71 | + regex: logcontent:foo2 |
| 72 | + |
| 73 | +- name: run workflow |
| 74 | + steps: |
| 75 | + - script: {{.cdsctl}} -f {{.cdsctl.config}} workflow run 04SCWORKFLOWRUNNOTIF 04SCWorkflowRunNotif-WORKFLOW-EMPTY |
| 76 | + assertions: |
| 77 | + - result.code ShouldEqual 0 |
| 78 | + - "result.systemout ShouldContainSubstring Workflow 04SCWorkflowRunNotif-WORKFLOW-EMPTY #1 has been launched" |
| 79 | + |
| 80 | +- name: check workflow |
| 81 | + steps: |
| 82 | + - script: {{.cdsctl}} -f {{.cdsctl.config}} workflow status 04SCWORKFLOWRUNNOTIF 04SCWorkflowRunNotif-WORKFLOW-EMPTY 1 --format json |
| 83 | + retry: 20 |
| 84 | + delay: 10 |
| 85 | + assertions: |
| 86 | + - result.code ShouldEqual 0 |
| 87 | + - result.systemoutjson.last_execution ShouldNotBeEmpty |
| 88 | + - result.systemoutjson.start ShouldNotBeEmpty |
| 89 | + - result.systemoutjson.num ShouldContainSubstring 1 |
| 90 | + - result.systemoutjson.status ShouldEqual Success |
| 91 | + |
| 92 | +- name: check-mail-notif |
| 93 | + steps: |
| 94 | + - type: http |
| 95 | + method: GET |
| 96 | + url: '{{.smtpmock.url}}/messages/[email protected]' |
| 97 | + assertions: |
| 98 | + - result.statuscode ShouldEqual 200 |
| 99 | + - result.bodyjson.__len__ ShouldEqual 1 |
0 commit comments