--- # yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json suite: container probes templates: - common.yaml values: - ../_values/controllers_main_default_container.yaml set: controllers.main.containers.main.probes.liveness.enabled: true controllers.main.containers.main.probes.readiness.enabled: true controllers.main.containers.main.probes.startup.enabled: true tests: - it: default should pass set: service: main: controller: main ports: http: enabled: true port: &port 80 asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].livenessProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: *port timeoutSeconds: 1 - documentIndex: 0 equal: path: spec.template.spec.containers[0].readinessProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: *port timeoutSeconds: 1 - documentIndex: 0 equal: path: spec.template.spec.containers[0].startupProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: *port timeoutSeconds: 1 - it: custom primary port should pass set: service: main: controller: main ports: http: enabled: true port: 80 test: enabled: true primary: true port: &port 8080 asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].livenessProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: *port timeoutSeconds: 1 - documentIndex: 0 equal: path: spec.template.spec.containers[0].readinessProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: *port timeoutSeconds: 1 - documentIndex: 0 equal: path: spec.template.spec.containers[0].startupProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: *port timeoutSeconds: 1 - it: default with string Service port should pass set: service: main: controller: main ports: http: enabled: true port: "80" asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].livenessProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: 80 timeoutSeconds: 1 - documentIndex: 0 equal: path: spec.template.spec.containers[0].readinessProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: 80 timeoutSeconds: 1 - documentIndex: 0 equal: path: spec.template.spec.containers[0].startupProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: 80 timeoutSeconds: 1 - it: multiple services should pass set: controllers: other: containers: main: image: repository: ghcr.io/mendhak/http-https-echo tag: 31 pullPolicy: IfNotPresent probes: liveness: enabled: true readiness: enabled: true startup: enabled: true service: other: controller: other ports: http: enabled: true port: &secondDeploymentPort 8080 main: controller: main ports: http: enabled: true port: &firstDeploymentPort 80 asserts: - documentIndex: &firstDeploymentDocument 0 isKind: of: Deployment - documentIndex: *firstDeploymentDocument equal: path: spec.template.spec.containers[0].livenessProbe.tcpSocket.port value: *firstDeploymentPort - documentIndex: *firstDeploymentDocument equal: path: spec.template.spec.containers[0].readinessProbe.tcpSocket.port value: *firstDeploymentPort - documentIndex: *firstDeploymentDocument equal: path: spec.template.spec.containers[0].startupProbe.tcpSocket.port value: *firstDeploymentPort - documentIndex: &secondDeploymentDocument 1 isKind: of: Deployment - documentIndex: *secondDeploymentDocument equal: path: spec.template.spec.containers[0].livenessProbe.tcpSocket.port value: *secondDeploymentPort - documentIndex: *secondDeploymentDocument equal: path: spec.template.spec.containers[0].readinessProbe.tcpSocket.port value: *secondDeploymentPort - documentIndex: *secondDeploymentDocument equal: path: spec.template.spec.containers[0].startupProbe.tcpSocket.port value: *secondDeploymentPort - it: disabled service should pass set: service: main: enabled: false controller: main asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 notExists: path: spec.template.spec.containers[0].livenessProbe - documentIndex: 0 notExists: path: spec.template.spec.containers[0].readinessProbe - documentIndex: 0 notExists: path: spec.template.spec.containers[0].startupProbe - it: AUTO type probe should pass set: service: main: controller: main ports: http: protocol: HTTP port: &port 80 controllers.main.containers.main.probes: liveness: enabled: true type: AUTO path: /api/version asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].livenessProbe value: httpGet: path: /api/version port: *port scheme: HTTP initialDelaySeconds: 0 periodSeconds: 10 timeoutSeconds: 1 failureThreshold: 3 - it: HTTP type probe should pass set: service: main: controller: main ports: http: port: &port 80 controllers.main.containers.main.probes: liveness: enabled: true type: HTTP path: /api/version asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].livenessProbe value: httpGet: path: /api/version port: *port scheme: HTTP initialDelaySeconds: 0 periodSeconds: 10 timeoutSeconds: 1 failureThreshold: 3 - it: HTTPS type probe should pass set: service: main: controller: main ports: http: port: &port 80 controllers.main.containers.main.probes: liveness: enabled: true type: HTTPS path: /api/version asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].livenessProbe value: httpGet: path: /api/version port: *port scheme: HTTPS initialDelaySeconds: 0 periodSeconds: 10 timeoutSeconds: 1 failureThreshold: 3 - it: custom liveness probe should pass set: service: main: controller: main ports: http: port: &port 80 controllers.main.containers.main.probes: liveness: enabled: true custom: true spec: httpGet: path: /api/version port: *port initialDelaySeconds: 0 periodSeconds: 10 timeoutSeconds: 1 failureThreshold: 3 asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].livenessProbe value: httpGet: path: /api/version port: *port initialDelaySeconds: 0 periodSeconds: 10 timeoutSeconds: 1 failureThreshold: 3 - it: custom readiness probe should pass set: service: main: controller: main ports: http: port: &port 80 controllers.main.containers.main.probes: readiness: enabled: true custom: true spec: httpGet: path: /api/version port: *port initialDelaySeconds: 0 periodSeconds: 10 timeoutSeconds: 1 failureThreshold: 3 asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].readinessProbe value: httpGet: path: /api/version port: *port initialDelaySeconds: 0 periodSeconds: 10 timeoutSeconds: 1 failureThreshold: 3 - it: custom startup probe should pass set: service: main: controller: main ports: http: port: &port 80 controllers.main.containers.main.probes: startup: enabled: true custom: true spec: httpGet: path: /api/version port: *port initialDelaySeconds: 0 periodSeconds: 10 timeoutSeconds: 1 failureThreshold: 3 asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].startupProbe value: httpGet: path: /api/version port: *port initialDelaySeconds: 0 periodSeconds: 10 timeoutSeconds: 1 failureThreshold: 3 - it: User-defined liveness probe port should pass set: service: main: controller: main ports: http: port: &port 80 controllers.main.containers.main.probes: liveness: enabled: true port: &port http asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].livenessProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: *port timeoutSeconds: 1 - it: User-defined liveness probe port should pass set: service: main: controller: main ports: http: port: &port 80 controllers.main.containers.main.probes: liveness: enabled: true port: &port http asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].livenessProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: *port timeoutSeconds: 1 - it: User-defined readiness probe port should pass set: service: main: controller: main ports: http: port: &port 80 controllers.main.containers.main.probes: readiness: enabled: true port: &port http asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].readinessProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: *port timeoutSeconds: 1 - it: User-defined startup probe port should pass set: service: main: controller: main ports: http: port: &port 80 controllers.main.containers.main.probes: startup: enabled: true port: &port http asserts: - documentIndex: 0 isKind: of: Deployment - documentIndex: 0 equal: path: spec.template.spec.containers[0].startupProbe value: failureThreshold: 3 initialDelaySeconds: 0 periodSeconds: 10 tcpSocket: port: *port timeoutSeconds: 1