Skip to content

Commit

Permalink
tests(pipeline_templates): integrations tests and removing unique ID
Browse files Browse the repository at this point in the history
  • Loading branch information
emjburns committed Sep 21, 2017
1 parent 59d9b1b commit 61cf6e6
Show file tree
Hide file tree
Showing 14 changed files with 261 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class PipelineTemplateErrorHandler : Handler {

if (context.getErrors().hasErrors(context.getRequest().plan)) {
context.getProcessedOutput().putAll(context.getErrors().toResponse())
context.getProcessedOutput().put("mptRequestId", context.getRequestId())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ public void validate(VersionedSchema configuration, Errors errors, SchemaValidat
.withSeverity(Severity.WARN));
}
});

// TODO rz - validate required variables are set and of the correct type
}

private static String location(String location) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
schema: "1"
id: child-template
source: example-root.yml # Indicates that this template inherits from the root-template
metadata:
name: Child template
description: A child template
stages:
- id: waitChild1
type: wait
dependsOn:
- wait1 # Depending on a stage from the root-template
config:
waitTime: "{{ waitTime }}" # Using a variable from the root-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
schema: "1"
pipeline:
application: myApp
name: My super awesome pipeline
template:
source: example-template.yml
variables:
waitTime: 20
childWaitTime: 15
configuration:
notifications:
- address: example@example.com
level: pipeline
name: email0
type: email
when:
- pipeline.failed
triggers: []
stages:
- id: finalWait
type: wait
dependsOn:
- waitChild1
- waitChild2
config:
waitTime: 10

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"keepWaitingPipelines": false,
"limitConcurrent": true,
"application": "myApp",
"name": "My super awesome pipeline",
"stages": [
{
"requisiteStageRefIds": [],
"name": "wait1",
"id": null,
"refId": "wait1",
"type": "wait",
"waitTime": 20
},
{
"requisiteStageRefIds": ["wait1"],
"id": null,
"name": "waitChild2",
"refId": "waitChild2",
"type": "wait",
"waitTime": 15
},
{
"requisiteStageRefIds": ["wait1"],
"id": null,
"name": "waitChild1",
"refId": "waitChild1",
"type": "wait",
"waitTime": 20
},
{
"requisiteStageRefIds": ["waitChild2", "waitChild1"],
"id": null,
"name": "finalWait",
"refId": "finalWait",
"type": "wait",
"waitTime": 10
}
],
"id": "unknown",
"notifications": [
{
"address": "example@example.com",
"level": "pipeline",
"name": "email0",
"when": ["pipeline.failed"],
"type": "email"
}
],
"parameterConfig": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
schema: "1" # Schema must match for all
id: root-template
metadata:
name: Simple wait template
description: Extendable root template
variables: # Variables available to all that inherit
- name: waitTime
description: The time a wait stage should pause
type: int
stages: # Stages available to all that inherit
- id: wait1
type: wait
config:
waitTime: "{{ waitTime }}" # Variables can be used anywhere
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
schema: "1"
id: child-2-template
source: example-child.yml
variables:
- name: childWaitTime
description: pause time for another wait
metadata:
name: A Second Child template
description: A second child template
stages:
- id: waitChild2
type: wait
dependsOn:
- wait1
config:
waitTime: "{{ childWaitTime }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
schema: "1"
pipeline:
application: myApp
name: My super awesome pipeline
template:
source: exampleCombined-template.yml
variables:
waitTime: 20
childWaitTime: 15
configuration:
notifications:
- address: example@example.com
level: pipeline
name: email0
type: email
when:
- pipeline.failed
triggers: []


Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"keepWaitingPipelines": false,
"limitConcurrent": true,
"application": "myApp",
"name": "My super awesome pipeline",
"stages": [
{
"requisiteStageRefIds": [],
"name": "wait1",
"id": null,
"refId": "wait1",
"type": "wait",
"waitTime": 20
},
{
"requisiteStageRefIds": ["wait1"],
"id": null,
"name": "waitChild2",
"refId": "waitChild2",
"type": "wait",
"waitTime": 15
},
{
"requisiteStageRefIds": ["wait1"],
"id": null,
"name": "waitChild1",
"refId": "waitChild1",
"type": "wait",
"waitTime": 20
},
{
"requisiteStageRefIds": ["waitChild2", "waitChild1"],
"id": null,
"name": "finalWait",
"refId": "finalWait",
"type": "wait",
"waitTime": 10
}
],
"id": "unknown",
"notifications": [
{
"address": "example@example.com",
"level": "pipeline",
"name": "email0",
"when": ["pipeline.failed"],
"type": "email"
}
],
"parameterConfig": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
schema: "1"
id: combined-template
metadata:
name: Less simple wait template
description: A template with many waits
variables:
- name: waitTime
description: The time a wait stage should pause
type: int
- name: childWaitTime
description: pause time for another wait
stages:
- id: wait1
type: wait
config:
waitTime: "{{ waitTime }}"
- id: waitChild1
type: wait
dependsOn:
- wait1
config:
waitTime: "{{ waitTime }}"
- id: waitChild2
type: wait
dependsOn:
- wait1
config:
waitTime: "{{ childWaitTime }}"
- id: finalWait
type: wait
dependsOn:
- waitChild1
- waitChild2
config:
waitTime: 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
schema: "1"
pipeline:
application: orca
stages:
- id: wait2
type: wait
config:
waitTime: "{{ waitTime }}"
dependsOn:
- wait1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"errors": [
{
"severity": "FATAL",
"cause": "The template being used has marked itself as protected",
"message": "Modification of the stage graph (adding, removing, editing) is disallowed"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
schema: "1"
id: simple
protect: true
metadata:
name: Barebones
description: The simplest template possible.
stages:
- id: wait1
type: wait
config:
waitTime: "{{ waitTime }}"

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"errors": [
{
"severity": "FATAL",
"message": "config schema version is unsupported: expected '1', got '0.1'"
"message": "unexpected schema version '0.1'"
}
]
}

0 comments on commit 61cf6e6

Please sign in to comment.