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