Skip to content

Commit

Permalink
feat(api): update scheduler test case to filter by workflow id
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlt committed Jul 23, 2019
1 parent d1bc77d commit 81508db
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 8 deletions.
2 changes: 2 additions & 0 deletions cli/cdsctl/admin_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func adminHooksTaskListRun(v cli.Values) (cli.ListResult, error) {
Stopped bool `cli:"Stopped"`
Project string `cli:"Project"`
Workflow string `cli:"Workflow"`
WorkflowID string `cli:"Workflow_ID"`
VCSServer string `cli:"VCSServer"`
RepoFullname string `cli:"RepoFullname"`
Cron string `cli:"Cron"`
Expand All @@ -80,6 +81,7 @@ func adminHooksTaskListRun(v cli.Values) (cli.ListResult, error) {
Stopped: p.Stopped,
Project: p.Config["project"].Value,
Workflow: p.Config["workflow"].Value,
WorkflowID: p.Config["workflow_id"].Value,
VCSServer: p.Config["vcsServer"].Value,
RepoFullname: p.Config["repoFullName"].Value,
Cron: p.Config["cron"].Value,
Expand Down
2 changes: 2 additions & 0 deletions cli/cdsctl/workflow_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ func workflowShowRun(v cli.Values) (interface{}, error) {
}
wrkflw := struct {
ProjectKey string `cli:"project_key"`
ID int64 `cli:"workflow_id,key"`
Name string `cli:"name"`
Description string `cli:"description"`
From string `cli:"from"`
URL string `cli:"url"`
API string `cli:"api"`
}{
ProjectKey: w.ProjectKey,
ID: w.ID,
Name: w.Name,
Description: w.Description,
From: w.FromRepository,
Expand Down
41 changes: 34 additions & 7 deletions tests/sc_workflow_edit_scheduler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,47 @@ testcases:
- script: "{{.cds.build.cdsctl}} project remove --force ITSCWRKFLW16"
- script: "{{.cds.build.cdsctl}} group remove --force ITSCWRKFLW16 "
- script: "{{.cds.build.cdsctl}} project add ITSCWRKFLW16 ITSCWRKFLW16"
assertions:
- result.code ShouldEqual 0

- name: import workflow
- name: import-workflow
steps:
- script: {{.cds.build.cdsctl}} workflow push ITSCWRKFLW16 ./tests/fixtures/ITSCWRKFLW16/edit_a/*.yml --skip-update-files
- script: {{.cds.build.cdsctl}} workflow export ITSCWRKFLW16 ITSCWRKFLW16-WORKFLOW --format json
- script: {{.cds.build.cdsctl}} workflow push ITSCWRKFLW16 ./tests/fixtures/ITSCWRKFLW16/edit_a/*.yml --skip-update-files
assertions:
- result.code ShouldEqual 0
- script: {{.cds.build.cdsctl}} workflow export ITSCWRKFLW16 ITSCWRKFLW16-WORKFLOW --format json
assertions:
- result.systemoutjson.pipeline_hooks.pipeline_hooks0.config.cron ShouldEqual '10 * * * *'
- script: {{.cds.build.cdsctl}} admin hooks list --filter workflow=ITSCWRKFLW16-WORKFLOW --format json

- name: get-imported-workflow
steps:
- script: {{.cds.build.cdsctl}} workflow show ITSCWRKFLW16 ITSCWRKFLW16-WORKFLOW --format json
assertions:
- result.code ShouldEqual 0

- name: check hook from service after import
steps:
- script: {{.cds.build.cdsctl}} admin hooks list --filter workflow_id={{.get-imported-workflow.result.systemoutjson.workflow_id}} --format json
assertions:
- result.systemoutjson.systemoutjson0.cron ShouldEqual '10 * * * *'
- script: {{.cds.build.cdsctl}} workflow push ITSCWRKFLW16 ./tests/fixtures/ITSCWRKFLW16/edit_b/*.yml --skip-update-files
- script: {{.cds.build.cdsctl}} workflow export ITSCWRKFLW16 ITSCWRKFLW16-WORKFLOW --format json

- name: update workflow
steps:
- script: {{.cds.build.cdsctl}} workflow push ITSCWRKFLW16 ./tests/fixtures/ITSCWRKFLW16/edit_b/*.yml --skip-update-files
assertions:
- result.code ShouldEqual 0
- script: {{.cds.build.cdsctl}} workflow export ITSCWRKFLW16 ITSCWRKFLW16-WORKFLOW --format json
assertions:
- result.systemoutjson.pipeline_hooks.pipeline_hooks0.config.cron ShouldEqual '20 * * * *'
- script: {{.cds.build.cdsctl}} admin hooks list --filter workflow=ITSCWRKFLW16-WORKFLOW --format json

- name: get-updated-workflow
steps:
- script: {{.cds.build.cdsctl}} workflow show ITSCWRKFLW16 ITSCWRKFLW16-WORKFLOW --format json
assertions:
- result.code ShouldEqual 0

- name: check hook from service after update
steps:
- script: {{.cds.build.cdsctl}} admin hooks list --filter workflow_id={{.get-updated-workflow.result.systemoutjson.workflow_id}} --format json
assertions:
- result.systemoutjson.systemoutjson0.cron ShouldEqual '20 * * * *'
4 changes: 3 additions & 1 deletion tests/sc_workflow_git_clone_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ testcases:
- script: "{{.cds.build.cdsctl}} project remove --force ITSCWRKFLW6"
- script: "{{.cds.build.cdsctl}} group remove --force ITSCWRKFLW6"
- script: "{{.cds.build.cdsctl}} project add ITSCWRKFLW6 ITSCWRKFLW6"
assertions:
- result.code ShouldEqual 0

- name: import pipeline
steps:
Expand All @@ -19,7 +21,7 @@ testcases:

- name: import workflow
steps:
- script: {{.cds.build.cdsctl}} workflow import --force ITSCWRKFLW6 ./tests/fixtures/ITSCWRKFLW6/ITSCWRKFLW6.yml
- script: {{.cds.build.cdsctl}} workflow import --force ITSCWRKFLW6 ./tests/fixtures/ITSCWRKFLW6/ITSCWRKFLW6.yml
assertions:
- result.code ShouldEqual 0

Expand Down

0 comments on commit 81508db

Please sign in to comment.