Skip to content

Commit 23c0a88

Browse files
feat(cf-common): add job template (#15)
1 parent e392cf4 commit 23c0a88

File tree

22 files changed

+329
-32
lines changed

22 files changed

+329
-32
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{- include "cf-common.controller" . -}}

charts/cf-common-test/templates/deployment.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

charts/cf-common-test/tests/deployment/classic_conn_uri_test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/quintush/helm-unittest/master/schema/helm-testsuite.json
22
suite: classic connection Uri
33
templates:
4-
- templates/deployment.yaml
4+
- templates/controller.yaml
55
tests:
66
- it: Test External RabbitMQ connection Uri
77
values:
@@ -45,4 +45,4 @@ tests:
4545
path: spec.template.spec.containers[0].env
4646
content:
4747
name: RABBIT_URL
48-
value: "amqp://user:pass@cf-rabbitmq"
48+
value: "amqp://user:pass@cf-rabbitmq"

charts/cf-common-test/tests/deployment/container_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/quintush/helm-unittest/master/schema/helm-testsuite.json
22
suite: deployment container spec
33
templates:
4-
- templates/deployment.yaml
4+
- templates/controller.yaml
55
values:
66
- values.yaml
77
tests:

charts/cf-common-test/tests/deployment/error_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/quintush/helm-unittest/master/schema/helm-testsuite.json
22
suite: deployment error handlers
33
templates:
4-
- templates/deployment.yaml
4+
- templates/controller.yaml
55
tests:
66
- it: Test invalid controller type
77
values:

charts/cf-common-test/tests/deployment/metadata_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/quintush/helm-unittest/master/schema/helm-testsuite.json
22
suite: deployment metadata
33
templates:
4-
- templates/deployment.yaml
4+
- templates/controller.yaml
55
tests:
66
- it: Test deployment default metadata
77
values:

charts/cf-common-test/tests/deployment/spec_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/quintush/helm-unittest/master/schema/helm-testsuite.json
22
suite: deployment spec
33
templates:
4-
- templates/deployment.yaml
4+
- templates/controller.yaml
55
values:
66
- values.yaml
77
tests:

charts/cf-common-test/tests/deployment/volumes_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/quintush/helm-unittest/master/schema/helm-testsuite.json
22
suite: depoyment volumes test
33
templates:
4-
- templates/deployment.yaml
4+
- templates/controller.yaml
55
values:
66
- values.yaml
77
tests:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/quintush/helm-unittest/master/schema/helm-testsuite.json
2+
suite: job error handlers
3+
templates:
4+
- templates/controller.yaml
5+
tests:
6+
- it: Test no .spec.selector
7+
values:
8+
- values.yaml
9+
asserts:
10+
- isNull:
11+
path: spec.selector
12+
13+
- it: Test no selector specified when manualSelector set to true
14+
set:
15+
controller:
16+
job:
17+
manualSelector: true
18+
values:
19+
- values.yaml
20+
asserts:
21+
- failedTemplate:
22+
errorMessage: "manualSelector is enabled! Specify `.job.selector` labels!"
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/quintush/helm-unittest/master/schema/helm-testsuite.json
2+
suite: job metadata
3+
templates:
4+
- templates/controller.yaml
5+
tests:
6+
- it: Test job default metadata
7+
values:
8+
- values.yaml
9+
asserts:
10+
- hasDocuments:
11+
count: 1
12+
- isKind:
13+
of: Job
14+
- isNull:
15+
path: metadata.annotations
16+
- equal:
17+
path: metadata.labels
18+
value:
19+
app.kubernetes.io/instance: RELEASE-NAME
20+
app.kubernetes.io/managed-by: Helm
21+
app.kubernetes.io/name: cf-common-test
22+
helm.sh/chart: cf-common-test-0.0.0
23+
- equal:
24+
path: metadata.name
25+
value: RELEASE-NAME-cf-common-test
26+
27+
- it: Test deployment custom metadata
28+
values:
29+
- values.yaml
30+
set:
31+
controller:
32+
labels:
33+
alice: bob
34+
annotations:
35+
foo: bar
36+
asserts:
37+
- hasDocuments:
38+
count: 1
39+
- isKind:
40+
of: Job
41+
- equal:
42+
path: metadata.annotations
43+
value:
44+
foo: bar
45+
- equal:
46+
path: metadata.labels
47+
value:
48+
app.kubernetes.io/instance: RELEASE-NAME
49+
app.kubernetes.io/managed-by: Helm
50+
app.kubernetes.io/name: cf-common-test
51+
helm.sh/chart: cf-common-test-0.0.0
52+
alice: bob
53+
54+
- it: Test pod labels and annotations
55+
values:
56+
- values.yaml
57+
set:
58+
podLabels:
59+
alice: bob
60+
podAnnotations:
61+
foo: bar
62+
asserts:
63+
- equal:
64+
path: spec.template.metadata.labels.alice
65+
value: bob
66+
- equal:
67+
path: spec.template.metadata.annotations.foo
68+
value: bar

0 commit comments

Comments
 (0)