Skip to content

Commit

Permalink
Passing kuttl tests
Browse files Browse the repository at this point in the history
Kuttl test for pipeline inputs alone
Kuttl test for supplychain driving pipeline

[]

Authored-by: Waciuma Wanjohi <lwanjohi@pivotal.io>
  • Loading branch information
waciumawanjohi committed Sep 21, 2021
1 parent fd0862a commit 39288c0
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 136 deletions.
4 changes: 2 additions & 2 deletions pkg/apis/v1alpha1/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ type PipelineStatus struct {

type PipelineSpec struct {
// +kubebuilder:validation:Required
RunTemplateRef TemplateReference `json:"runTemplateRef"`
Inputs map[string]apiextensionsv1.JSON `json:"inputs,omitempty"`
RunTemplateRef TemplateReference `json:"runTemplateRef"`
Inputs map[string]apiextensionsv1.JSON `json:"inputs,omitempty"`
}

type TemplateReference struct {
Expand Down
16 changes: 0 additions & 16 deletions tests/kuttl/pipe-iter/00-assert.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions tests/kuttl/pipe-iter/00-pipeline.yaml

This file was deleted.

16 changes: 13 additions & 3 deletions tests/kuttl/pipeline-with-inputs/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@
# limitations under the License.

---

apiVersion: carto.run/v1alpha1
kind: RunTemplate
metadata:
name: my-run-template-inputs
kind: Deliverable
value:
object:
nested: hi
still-nested: bye
list:
- position: one
val: first
- position: two
val: second
string: silly
int: 3
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ spec:
name: my-run-template-inputs

inputs:
source-url:
three: four
source-revision: gaming
some-object:
nested: hi
still-nested: bye
some-list:
- position: one
val: first
- position: two
val: second
some-int: 3
some-string: silly
12 changes: 7 additions & 5 deletions tests/kuttl/pipeline-with-inputs/00-run-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ metadata:
name: my-run-template-inputs
spec:
template:
apiVersion: v1
kind: ConfigMap
apiVersion: carto.run/v1alpha1
kind: Deliverable
metadata:
generateName: my-stamped-resource-inputs-
data:
url: $(pipeline.spec.inputs.params.source-url)$
revision: $(pipeline.spec.inputs.params.source-revision)$
value:
object: $(pipeline.spec.inputs.some-object)$
list: $(pipeline.spec.inputs.some-list)$
string: $(pipeline.spec.inputs.some-string)$
int: $(pipeline.spec.inputs.some-int)$
32 changes: 0 additions & 32 deletions tests/kuttl/pipeline-with-inputs/02-assert.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions tests/kuttl/pipeline-with-inputs/03-assert.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ spec:
value:
url: $(pipeline.spec.inputs.source-url)$
revision: $(pipeline.spec.inputs.source-revision)$
some-object-def: $(pipeline.spec.inputs.definition)$
some-hard-coded-info: not-from-the-pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#---
#apiVersion: carto.run/v1alpha1
#kind: ClusterSourceTemplate
#metadata:
# name: source---pipeline-with-inputs
#spec:
# template:
# apiVersion: v1
# kind: ConfigMap
# metadata:
# name: example-first-configmap
# data:
# player_initial_lives: "three"
# player_loves: "gaming"
# urlPath: data.player_initial_lives
# revisionPath: data.player_loves
---
apiVersion: carto.run/v1alpha1
kind: ClusterSourceTemplate
metadata:
name: source---pipelines-driven-by-supply-chain
spec:
template:
apiVersion: v1
kind: ConfigMap
metadata:
name: example-first-configmap
data:
url: $(workload.spec.source.git.url)$
branch: "main"
urlPath: data.url
revisionPath: data.branch

---
apiVersion: carto.run/v1alpha1
kind: ClusterSourceTemplate
metadata:
name: pipeline---pipeline-with-inputs
name: pipeline---pipelines-driven-by-supply-chain
spec:
# TODO: not implemented yet
# TODO: update in story 4
urlPath: .spec.runTemplateRef.name
revisionPath: .spec.runTemplateRef.name

params:
- name: expected-param
default:
key: value

template:
apiVersion: carto.run/v1alpha1
kind: Pipeline
Expand All @@ -48,11 +53,9 @@ spec:
my-label: this-is-it
spec:
runTemplateRef:
name: my-run-template
name: my-run-template-inputs

inputs:
params:
- name: source-url
value: three
- name: source-revision
value: gaming
source-url: $(sources[0].url)$
source-revision: $(sources[0].revision)$
definition: $(params[0].value)$
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,23 @@
apiVersion: carto.run/v1alpha1
kind: ClusterSupplyChain
metadata:
name: supply-chain---pipeline-with-inputs
name: supply-chain---pipelines-driven-by-supply-chain
spec:
selector:
integration-test: "pipeline-with-inputs"
integration-test: "pipelines-driven-by-supply-chain"
components:
# - name: source-provider
# templateRef:
# kind: ClusterSourceTemplate
# name: source---pipeline-with-inputs
- name: source-provider
templateRef:
kind: ClusterSourceTemplate
name: source---pipelines-driven-by-supply-chain

- name: pipeline-provider
templateRef:
kind: ClusterSourceTemplate
name: pipeline---pipeline-with-inputs
# sources:
# - component: source-provider
# name: source-provider
name: pipeline---pipelines-driven-by-supply-chain
sources:
- component: source-provider
name: source-provider
params:
- name: expected-param
value: $(workload.spec.params[0].value)$
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
apiVersion: carto.run/v1alpha1
kind: Deliverable
value:
url:
three: four
revision: gaming
url: https://github.com/spring-projects/spring-petclinic.git
revision: main
some-object-def:
apiVersion: v1
kind: ConfigMap
metadata:
name: some-configmap
data:
an-ice-cream-flavor: cookies-and-cream
some-hard-coded-info: not-from-the-pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,17 @@ kind: Workload
metadata:
name: petclinic
labels:
integration-test: "pipeline-with-inputs"
integration-test: "pipelines-driven-by-supply-chain"
spec:
params:
- name: a-config-map
value:
apiVersion: v1
kind: ConfigMap
metadata:
name: some-configmap
data:
an-ice-cream-flavor: cookies-and-cream
source:
git:
url: https://github.com/spring-projects/spring-petclinic.git
url: https://github.com/spring-projects/spring-petclinic.git

0 comments on commit 39288c0

Please sign in to comment.