feat(common): Release 2.0.0-beta.2 (#176)

This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2023-09-14 15:40:49 +02:00 committed by GitHub
parent ed407c00df
commit 9928235b84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
80 changed files with 1306 additions and 161 deletions

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: configmap metadata
templates:
- common.yaml
@ -14,7 +16,7 @@ tests:
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
isNull:
notExists:
path: metadata.annotations
- documentIndex: *ConfigmapDocument
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: configMap names
templates:
- common.yaml
@ -48,13 +50,13 @@ tests:
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
isNotNull:
isNotNullOrEmpty:
path: metadata.name
- documentIndex: &SecondConfigmapDocument 3
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
isNotNull:
isNotNullOrEmpty:
path: metadata.name
- it: default name should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: configmap Pod metadata
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container args override
templates:
- common.yaml
@ -8,7 +10,7 @@ tests:
isKind:
of: Deployment
- documentIndex: 0
isNull:
notExists:
path: spec.template.spec.containers[0].args
- it: single string should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container command override
templates:
- common.yaml
@ -8,7 +10,7 @@ tests:
isKind:
of: Deployment
- documentIndex: 0
isNull:
notExists:
path: spec.template.spec.containers[0].command
- it: single string should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container env values
templates:
- common.yaml
@ -8,7 +10,7 @@ tests:
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
isNull:
notExists:
path: spec.template.spec.containers[0].env
- it: KeyValue string should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container envFrom values
templates:
- common.yaml
@ -8,7 +10,7 @@ tests:
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
isNull:
notExists:
path: spec.template.spec.containers[0].envFrom
- it: explicit envFrom should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container image tag
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container name
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container ports
templates:
- common.yaml
@ -8,7 +10,7 @@ tests:
isKind:
of: Deployment
- documentIndex: 0
isNull:
notExists:
path: spec.template.spec.containers[0].ports
- it: custom port should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container probes
templates:
- common.yaml
@ -145,13 +147,13 @@ tests:
isKind:
of: Deployment
- documentIndex: 0
isNull:
notExists:
path: spec.template.spec.containers[0].livenessProbe
- documentIndex: 0
isNull:
notExists:
path: spec.template.spec.containers[0].readinessProbe
- documentIndex: 0
isNull:
notExists:
path: spec.template.spec.containers[0].startupProbe
- it: AUTO type probe should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container volumeMounts
templates:
- common.yaml
@ -8,7 +10,7 @@ tests:
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
isNull:
notExists:
path: spec.template.spec.containers[0].volumeMounts
- it: default should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob configuration
templates:
- common.yaml
@ -28,7 +30,7 @@ tests:
path: spec.failedJobsHistoryLimit
value: 1
- documentIndex: *ControllerDoc
isNull:
notExists:
path: spec.jobTemplate.spec.ttlSecondsAfterFinished
- documentIndex: *ControllerDoc
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller metadata cronjob
templates:
- common.yaml
@ -10,7 +12,7 @@ tests:
isKind:
of: CronJob
- documentIndex: *ControllerDoc
isNull:
notExists:
path: metadata.annotations
- documentIndex: *ControllerDoc
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller metadata daemonset
templates:
- common.yaml
@ -10,7 +12,7 @@ tests:
isKind:
of: DaemonSet
- documentIndex: *ControllerDoc
isNull:
notExists:
path: metadata.annotations
- documentIndex: *ControllerDoc
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller metadata deployment
templates:
- common.yaml
@ -10,7 +12,7 @@ tests:
isKind:
of: Deployment
- documentIndex: *ControllerDoc
isNull:
notExists:
path: metadata.annotations
- documentIndex: *ControllerDoc
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller metadata statefulset
templates:
- common.yaml
@ -10,7 +12,7 @@ tests:
isKind:
of: StatefulSet
- documentIndex: *ControllerDoc
isNull:
notExists:
path: metadata.annotations
- documentIndex: *ControllerDoc
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller types
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress metadata
templates:
- common.yaml
@ -10,7 +12,7 @@ tests:
isKind:
of: Ingress
- documentIndex: *IngressDocument
isNull:
notExists:
path: metadata.annotations
- documentIndex: *IngressDocument
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress presence
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress service reference
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress tls
templates:
- common.yaml
@ -10,7 +12,7 @@ tests:
isKind:
of: Ingress
- documentIndex: *IngressDocument
isNull:
notExists:
path: spec.tls
- it: tls enabled should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress values
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: nameOverride tests
templates:
- common.yaml

View file

@ -0,0 +1,89 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: networkPolicy metadata
templates:
- common.yaml
tests:
- it: default metadata should pass
set:
networkpolicies:
main:
enabled: true
asserts:
- documentIndex: &NetworkPolicyDocument 2
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
notExists:
path: metadata.annotations
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
set:
networkpolicies:
main:
enabled: true
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &NetworkPolicyDocument 2
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
networkpolicies:
main:
enabled: true
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &NetworkPolicyDocument 2
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -0,0 +1,36 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: networkPolicy names
templates:
- common.yaml
tests:
- it: default should pass
set:
networkpolicies:
main:
enabled: true
asserts:
- hasDocuments:
count: 3
- documentIndex: &NetworkPolicyDocument 2
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.name
value: RELEASE-NAME
- it: custom name suffix should pass
set:
networkpolicies:
main:
enabled: true
nameOverride: block-ingress
asserts:
- documentIndex: &NetworkPolicyDocument 2
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.name
value: RELEASE-NAME-block-ingress

View file

@ -0,0 +1,36 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: NetworkPolicy validations
templates:
- common.yaml
tests:
- it: networkpolicy requires either controller reference or podSelector
set:
networkpolicies:
main:
enabled: true
controller: ""
asserts:
- failedTemplate:
errorMessage: "controller reference or podSelector is required for NetworkPolicy. (NetworkPolicy main)"
- it: policyTypes is required
set:
networkpolicies:
main:
enabled: true
policyTypes: []
asserts:
- failedTemplate:
errorMessage: "policyTypes is required for NetworkPolicy. (NetworkPolicy main)"
- it: policyTypes values check
set:
networkpolicies:
main:
enabled: true
policyTypes:
- test
asserts:
- failedTemplate:
errorMessage: "Not a valid policyType for NetworkPolicy. (NetworkPolicy main, value test)"

View file

@ -0,0 +1,95 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: NetworkPolicy values
templates:
- common.yaml
tests:
- it: main networkpolicy is disabled by default
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 1
isKind:
of: Service
- it: main networkpolicy can be enabled
set:
networkpolicies:
main:
enabled: true
asserts:
- hasDocuments:
count: 3
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 1
isKind:
of: Service
- documentIndex: 2
isKind:
of: NetworkPolicy
- it: networkpolicy targets the correct controller
set:
networkpolicies:
main:
enabled: true
controller: main
asserts:
- documentIndex: &NetworkPolicyDocument 2
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: spec.podSelector
value:
matchLabels:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
- it: networkpolicy targets supports custom podSelector
set:
networkpolicies:
main:
enabled: true
controller: main
podSelector: {}
asserts:
- documentIndex: &NetworkPolicyDocument 2
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: spec.podSelector
value: {}
- it: networkpolicy rules are passed through
set:
networkpolicies:
main:
enabled: true
controller: main
rules:
ingress:
- {}
egress:
- {}
asserts:
- documentIndex: &NetworkPolicyDocument 2
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: spec.ingress
value:
- {}
- documentIndex: *NetworkPolicyDocument
equal:
path: spec.egress
value:
- {}

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: persistence claimnames
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: persistence emptydir
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: persistence hostpath
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: persistence types
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: persistence volumeclaimtemplates
templates:
- common.yaml

View file

@ -0,0 +1,81 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod sidecar containers
templates:
- common.yaml
tests:
- it: with default order
set:
controllers.main.containers:
additional1:
image:
repository: test
tag: test
additional2:
image:
repository: test
tag: test
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: &DeploymentDocument 0
lengthEqual:
path: spec.template.spec.containers
count: 3
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].name
value: main
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].name
value: additional1
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[2].name
value: additional2
- it: with custom order
set:
controllers.main.containers:
main:
order: 2
additional1:
order: 3
image:
repository: test
tag: test
additional2:
order: 1
image:
repository: test
tag: test
additional3:
image:
repository: test
tag: test
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: &DeploymentDocument 0
lengthEqual:
path: spec.template.spec.containers
count: 4
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].name
value: additional2
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].name
value: main
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[2].name
value: additional1
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[3].name
value: additional3

View file

@ -0,0 +1,89 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod affinity
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.affinity
- it: defaultPodOption should pass
set:
defaultPodOptions:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- antarctica-east1
- antarctica-west1
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.affinity
value:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- antarctica-east1
- antarctica-west1
- it: defaultPodOption with pod override should pass
set:
defaultPodOptions:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- antarctica-east1
- antarctica-west1
controllers:
main:
pod:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- asia-east1
- asia-west1
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.affinity
value:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- asia-east1
- asia-west1

View file

@ -0,0 +1,59 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod dnsConfig
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.dnsConfig
- it: defaultPodOption should pass
set:
defaultPodOptions:
dnsConfig:
options:
- name: ndots
value: "1"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.dnsConfig
value:
options:
- name: ndots
value: "1"
- it: defaultPodOption with pod override should pass
set:
defaultPodOptions:
dnsConfig:
options:
- name: ndots
value: "1"
controllers:
main:
pod:
dnsConfig:
options:
- name: ndots
value: "5"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.dnsConfig
value:
options:
- name: ndots
value: "5"

View file

@ -1,4 +1,6 @@
suite: pod network
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod dnsPolicy
templates:
- common.yaml
tests:
@ -7,27 +9,6 @@ tests:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostNetwork
value: false
- documentIndex: 0
equal:
path: spec.template.spec.dnsPolicy
value: ClusterFirst
- it: hostNetwork disabled should pass
set:
defaultPodOptions:
hostNetwork: false
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostNetwork
value: false
- documentIndex: 0
equal:
path: spec.template.spec.dnsPolicy
@ -41,10 +22,6 @@ tests:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostNetwork
value: true
- documentIndex: 0
equal:
path: spec.template.spec.dnsPolicy

View file

@ -0,0 +1,62 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod hostAliases
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.hostAliases
- it: defaultPodOption should pass
set:
defaultPodOptions:
hostAliases:
- ip: "192.168.1.100"
hostnames:
- "example.com"
- "www.example.com"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostAliases
value:
- ip: "192.168.1.100"
hostnames:
- "example.com"
- "www.example.com"
- it: defaultPodOption with pod override should pass
set:
defaultPodOptions:
hostAliases:
- ip: "192.168.1.100"
hostnames:
- "example.com"
- "www.example.com"
controllers:
main:
pod:
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "localhost"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostAliases
value:
- ip: "127.0.0.1"
hostnames:
- "localhost"

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod security
templates:
- common.yaml

View file

@ -0,0 +1,41 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod hostNetwork
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostNetwork
value: false
- it: hostNetwork disabled should pass
set:
defaultPodOptions:
hostNetwork: false
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostNetwork
value: false
- it: hostNetwork enabled should pass
set:
defaultPodOptions:
hostNetwork: true
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostNetwork
value: true

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod security
templates:
- common.yaml

View file

@ -0,0 +1,49 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod imagePullSecrets
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.imagePullSecrets
- it: defaultPodOption should pass
set:
defaultPodOptions:
imagePullSecrets:
- name: my-pull-secret
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.imagePullSecrets
value:
- name: my-pull-secret
- it: defaultPodOption with pod override should pass
set:
defaultPodOptions:
imagePullSecrets:
- name: my-pull-secret
controllers:
main:
pod:
imagePullSecrets:
- name: my-other-secret
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.imagePullSecrets
value:
- name: my-other-secret

View file

@ -0,0 +1,49 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod nodeSelector
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.nodeSelector
- it: defaultPodOption should pass
set:
defaultPodOptions:
nodeSelector:
disktype: ssd
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.nodeSelector
value:
disktype: ssd
- it: defaultPodOption with pod override should pass
set:
defaultPodOptions:
nodeSelector:
disktype: ssd
controllers:
main:
pod:
nodeSelector:
disktype: hdd
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.nodeSelector
value:
disktype: hdd

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod replicas
templates:
- common.yaml

View file

@ -0,0 +1,64 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod securityContext
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.securityContext
- it: defaultPodOption should pass
set:
defaultPodOptions:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
fsGroupChangePolicy: OnRootMismatch
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.securityContext
value:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
fsGroupChangePolicy: OnRootMismatch
- it: defaultPodOption with pod override should pass
set:
defaultPodOptions:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
fsGroupChangePolicy: OnRootMismatch
controllers:
main:
pod:
securityContext:
runAsUser: 568
runAsGroup: 568
fsGroup: 568
fsGroupChangePolicy: OnRootMismatch
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.securityContext
value:
runAsUser: 568
runAsGroup: 568
fsGroup: 568
fsGroupChangePolicy: OnRootMismatch

View file

@ -0,0 +1,64 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod tolerations
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.tolerations
- it: defaultPodOption should pass
set:
defaultPodOptions:
tolerations:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.tolerations
value:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
- it: defaultPodOption with pod override should pass
set:
defaultPodOptions:
tolerations:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
controllers:
main:
pod:
tolerations:
- key: "master"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.tolerations
value:
- key: "master"
operator: "Equal"
value: "value1"
effect: "NoSchedule"

View file

@ -0,0 +1,74 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod topologySpreadConstraints
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.topologySpreadConstraints
- it: defaultPodOption should pass
set:
defaultPodOptions:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.topologySpreadConstraints
value:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
- it: defaultPodOption with pod override should pass
set:
defaultPodOptions:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
controllers:
main:
pod:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.topologySpreadConstraints
value:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod initContainers
templates:
- common.yaml
@ -41,3 +43,46 @@ tests:
value:
name: template
value: RELEASE-NAME-admin
- it: disabled should pass
set:
controllers.main.initContainers:
init1:
enabled: false
image:
repository: ghcr.io/mendhak/http-https-echo
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
notExists:
path: spec.template.spec.initContainers
- it: custom order should pass
set:
controllers.main.initContainers:
init1:
order: 2
image:
repository: ghcr.io/mendhak/http-https-echo
init2:
order: 1
image:
repository: ghcr.io/mendhak/http-https-echo
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
lengthEqual:
path: spec.template.spec.initContainers
count: 2
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.initContainers[0].name
value: init2
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.initContainers[1].name
value: init1

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod sidecar containers
templates:
- common.yaml
@ -16,7 +18,7 @@ tests:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].name
path: spec.template.spec.containers[1].name
value: template-test
- it: with implicit name should pass
@ -32,7 +34,7 @@ tests:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].name
path: spec.template.spec.containers[1].name
value: additional1
- it: with templated name should pass
@ -49,7 +51,7 @@ tests:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].name
path: spec.template.spec.containers[1].name
value: RELEASE-NAME-container
- it: with custom env vars dict should pass
@ -73,31 +75,31 @@ tests:
of: Deployment
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].env[0]
path: spec.template.spec.containers[0].env[0]
value:
name: main_env
value: "value"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].env[0]
path: spec.template.spec.containers[1].env[0]
value:
name: float
value: "1.5"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].env[1]
path: spec.template.spec.containers[1].env[1]
value:
name: int
value: "1"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].env[2]
path: spec.template.spec.containers[1].env[2]
value:
name: string
value: value_of_env
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].env[3]
path: spec.template.spec.containers[1].env[3]
value:
name: template
value: RELEASE-NAME-admin

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pvc metadata
templates:
- common.yaml
@ -10,7 +12,7 @@ tests:
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
isNull:
notExists:
path: metadata.annotations
- documentIndex: *PersistentVolumeClaimDocument
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pvc names
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pvc storageclass
templates:
- common.yaml
@ -10,7 +12,7 @@ tests:
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
isNull:
notExists:
path: spec.storageClassName
- it: custom should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: route metadata
templates:
- common.yaml
@ -14,7 +16,7 @@ tests:
isKind:
of: HTTPRoute
- documentIndex: *routeDocument
isNull:
notExists:
path: metadata.annotations
- documentIndex: *routeDocument
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: route presence
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress service reference
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: route values
templates:
- common.yaml
@ -51,8 +53,8 @@ tests:
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
- name: test
namespace: test
matches:
- path:
type: PathPrefix
@ -65,8 +67,8 @@ tests:
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
- name: test
namespace: test
matches:
- path:
type: PathPrefix
@ -79,8 +81,8 @@ tests:
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
- name: test
namespace: test
matches:
- path:
type: PathPrefix
@ -93,8 +95,8 @@ tests:
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
- name: test
namespace: test
matches:
- path:
type: PathPrefix
@ -107,8 +109,8 @@ tests:
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
- name: test
namespace: test
matches:
- path:
type: PathPrefix
@ -118,7 +120,7 @@ tests:
isKind:
of: GRPCRoute
- documentIndex: &HTTPRouteDocument 2
isNull:
notExists:
path: spec.rules[0].matches
- documentIndex: &HTTPRouteDocument 3
isKind:
@ -134,19 +136,19 @@ tests:
isKind:
of: TCPRoute
- documentIndex: &HTTPRouteDocument 4
isNull:
notExists:
path: spec.rules[0].matches
- documentIndex: &HTTPRouteDocument 5
isKind:
of: TLSRoute
- documentIndex: &HTTPRouteDocument 5
isNull:
notExists:
path: spec.rules[0].matches
- documentIndex: &HTTPRouteDocument 6
isKind:
of: UDPRoute
- documentIndex: &HTTPRouteDocument 6
isNull:
notExists:
path: spec.rules[0].matches
- it: hostnames shouldn't be used for TCPRoutes and UDPRoutes
@ -173,13 +175,13 @@ tests:
isKind:
of: TCPRoute
- documentIndex: &HTTPRouteDocument 2
isNull:
notExists:
path: spec.hostnames
- documentIndex: &HTTPRouteDocument 3
isKind:
of: UDPRoute
- documentIndex: &HTTPRouteDocument 3
isNull:
notExists:
path: spec.hostnames
- it: sectionName in parentRefs should be optional
@ -201,7 +203,7 @@ tests:
isKind:
of: HTTPRoute
- documentIndex: &HTTPRouteDocument 2
isNull:
notExists:
path: spec.parentRefs[0].sectionName
- documentIndex: &HTTPRouteDocument 3
isKind:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: secret metadata
templates:
- common.yaml
@ -14,7 +16,7 @@ tests:
isKind:
of: Secret
- documentIndex: *SecretDocument
isNull:
notExists:
path: metadata.annotations
- documentIndex: *SecretDocument
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: secret names
templates:
- common.yaml
@ -48,13 +50,13 @@ tests:
isKind:
of: Secret
- documentIndex: *FirstSecretDocument
isNotNull:
isNotNullOrEmpty:
path: metadata.name
- documentIndex: &SecondSecretDocument 3
isKind:
of: Secret
- documentIndex: *SecondSecretDocument
isNotNull:
isNotNullOrEmpty:
path: metadata.name
- it: default name should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: secret Pod metadata
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: service metadata
templates:
- common.yaml
@ -8,7 +10,7 @@ tests:
isKind:
of: Service
- documentIndex: *ServiceDocument
isNull:
notExists:
path: metadata.annotations
- documentIndex: *ServiceDocument
equal:

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: service names
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: service protocols
templates:
- common.yaml
@ -50,7 +52,7 @@ tests:
path: spec.ports[0].protocol
value: TCP
- documentIndex: *ServiceDocument
isNull:
notExists:
path: metadata.annotations
- it: explicit HTTPS should pass

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: service ports
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: serviceAccount values
templates:
- common.yaml

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: serviceMonitor values
templates:
- common.yaml