--- # yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json suite: service values templates: - common.yaml values: - ../_values/controllers_main_default_container.yaml tests: - it: ports and services are enabled by default set: service: second: type: ClusterIP controller: main ports: first: port: 80 asserts: - hasDocuments: count: 2 - documentIndex: &FirstServiceDocument 1 isKind: of: Service - documentIndex: *FirstServiceDocument notExists: path: spec.allocateLoadBalancerNodePorts - it: services can be disabled values: - ../_values/service_main_default.yaml set: service: main: enabled: false asserts: - hasDocuments: count: 1 - documentIndex: &DeploymentDocument 0 isKind: of: Deployment - it: externalTrafficPolicy should pass for NodePort service values: - ../_values/service_main_default.yaml set: service: main: type: NodePort externalTrafficPolicy: Local asserts: - documentIndex: &ServiceDocument 1 isKind: of: Service - documentIndex: *ServiceDocument equal: path: spec.externalTrafficPolicy value: Local - it: externalTrafficPolicy should pass for LoadBalancer service values: - ../_values/service_main_default.yaml set: service: main: type: LoadBalancer externalTrafficPolicy: Local asserts: - documentIndex: &ServiceDocument 1 isKind: of: Service - documentIndex: *ServiceDocument equal: path: spec.externalTrafficPolicy value: Local - it: allocateLoadBalancerNodePorts can be set to true values: - ../_values/service_main_default.yaml set: service: main: type: LoadBalancer allocateLoadBalancerNodePorts: true asserts: - documentIndex: &ServiceDocument 1 isKind: of: Service - documentIndex: *ServiceDocument equal: path: spec.allocateLoadBalancerNodePorts value: true - it: allocateLoadBalancerNodePorts can be set to false values: - ../_values/service_main_default.yaml set: service: main: type: LoadBalancer allocateLoadBalancerNodePorts: false asserts: - documentIndex: &ServiceDocument 1 isKind: of: Service - documentIndex: *ServiceDocument equal: path: spec.allocateLoadBalancerNodePorts value: false