mirror of
https://github.com/truenas/charts.git
synced 2026-06-17 15:38:49 +08:00
add more tests
This commit is contained in:
362
library/common-test/tests/service/service_test_LoadBalancer.yaml
Normal file
362
library/common-test/tests/service/service_test_LoadBalancer.yaml
Normal file
@@ -0,0 +1,362 @@
|
||||
suite: service test LoadBalancer
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with correct apiVersion
|
||||
documentIndex: &serviceDoc 1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Service
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
|
||||
- it: should pass with LoadBalancer service type
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: &defaultPort
|
||||
- name: main
|
||||
port: 65535
|
||||
protocol: TCP
|
||||
targetPort: main
|
||||
selector: &defaultSelector
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: common-test
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with LoadBalancer service type and loadBalancerIP set
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: 10.16.0.12
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: 10.16.0.12
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with LoadBalancer service type and loadBalancerSourceRanges set
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
loadBalancerSourceRanges:
|
||||
- 10.16.0.14
|
||||
- 10.16.0.15
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
loadBalancerSourceRanges:
|
||||
- 10.16.0.14
|
||||
- 10.16.0.15
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with LoadBalancer service type and loadBalancerSourceRanges set from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 10.16.0.14
|
||||
ip2: 10.16.0.15
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
loadBalancerSourceRanges:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
loadBalancerSourceRanges:
|
||||
- 10.16.0.14
|
||||
- 10.16.0.15
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with LoadBalancer service type, loadBalancerIP and loadBalancerSourceRanges set from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 10.16.0.14
|
||||
ip2: 10.16.0.15
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: 10.16.0.12
|
||||
loadBalancerSourceRanges:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: 10.16.0.12
|
||||
loadBalancerSourceRanges:
|
||||
- 10.16.0.14
|
||||
- 10.16.0.15
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with LoadBalancer service type and clusterIP set
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
clusterIP: 172.16.0.12
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
clusterIP: 172.16.0.12
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with LoadBalancer service type and externalTrafficPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
externalTrafficPolicy: Cluster
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
externalTrafficPolicy: Cluster
|
||||
|
||||
- it: should pass with LoadBalancer service type and sessionAffinity set to None
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
sessionAffinity: None
|
||||
sessionAffinityConfig:
|
||||
ClientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: None
|
||||
- isNull:
|
||||
path: spec.sessionAffinityConfig
|
||||
|
||||
- it: should pass with LoadBalancer service type and sessionAffinity set to ClientIP
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
|
||||
- it: should pass with LoadBalancer service type and sessionAffinity set to ClientIP from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
timeout: 1000
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
|
||||
- it: should pass with LoadBalancer service type and externalIPs
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
|
||||
- it: should pass with LoadBalancer service type and externalIPs from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 192.168.1.20
|
||||
ip2: 192.168.1.21
|
||||
ip3: 192.168.1.22
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
externalIPs:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
- "{{ .Values.ip3 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
|
||||
- it: should pass with LoadBalancer service type and publishNotReadyAddresses
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
publishNotReadyAddresses: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
publishNotReadyAddresses: true
|
||||
|
||||
- it: should pass with LoadBalancer service type and ipFamilyPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
ipFamilyPolicy: SingleStack
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
ipFamilyPolicy: SingleStack
|
||||
|
||||
- it: should pass with LoadBalancer service type and ipFamilies
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
ipFamilies:
|
||||
- IPv6
|
||||
- IPv4
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
ipFamilies:
|
||||
- IPv6
|
||||
- IPv4
|
||||
|
||||
- it: should pass with LoadBalancer service type and custom selector
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
|
||||
- it: should pass with LoadBalancer service type and custom selector from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
k1: some_value
|
||||
k2: some_value1
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
some_key: "{{ .Values.k1 }}"
|
||||
some_key1: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
320
library/common-test/tests/service/service_test_NodePort.yaml
Normal file
320
library/common-test/tests/service/service_test_NodePort.yaml
Normal file
@@ -0,0 +1,320 @@
|
||||
suite: service test NodePort
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with correct apiVersion
|
||||
documentIndex: &serviceDoc 1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Service
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
|
||||
- it: should pass with NodePort service type
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: &defaultPort
|
||||
- name: main
|
||||
port: 65535
|
||||
protocol: TCP
|
||||
targetPort: main
|
||||
nodePort: 35000
|
||||
selector: &defaultSelector
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: common-test
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with NodePort service type and clusterIP set
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
clusterIP: 172.16.0.12
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
clusterIP: 172.16.0.12
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with NodePort service type and externalTrafficPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
externalTrafficPolicy: Cluster
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
externalTrafficPolicy: Cluster
|
||||
|
||||
- it: should pass with NodePort service type and sessionAffinity set to None
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
sessionAffinity: None
|
||||
sessionAffinityConfig:
|
||||
ClientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: None
|
||||
- isNull:
|
||||
path: spec.sessionAffinityConfig
|
||||
|
||||
- it: should pass with NodePort service type and sessionAffinity set to ClientIP
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
|
||||
- it: should pass with NodePort service type and sessionAffinity set to ClientIP from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
timeout: 1000
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
|
||||
- it: should pass with NodePort service type and externalIPs
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
|
||||
- it: should pass with NodePort service type and externalIPs from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 192.168.1.20
|
||||
ip2: 192.168.1.21
|
||||
ip3: 192.168.1.22
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
externalIPs:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
- "{{ .Values.ip3 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
|
||||
- it: should pass with NodePort service type and publishNotReadyAddresses
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
publishNotReadyAddresses: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
publishNotReadyAddresses: true
|
||||
|
||||
- it: should pass with NodePort service type and ipFamilyPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
ipFamilyPolicy: SingleStack
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
ipFamilyPolicy: SingleStack
|
||||
|
||||
- it: should pass with NodePort service type and ipFamilies
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
ipFamilies:
|
||||
- IPv6
|
||||
- IPv4
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
ipFamilies:
|
||||
- IPv6
|
||||
- IPv4
|
||||
|
||||
- it: should pass with NodePort service type and custom selector
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
|
||||
- it: should pass with NodePort service type and custom selector from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
k1: some_value
|
||||
k2: some_value1
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
selector:
|
||||
some_key: "{{ .Values.k1 }}"
|
||||
some_key1: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
@@ -1,513 +0,0 @@
|
||||
|
||||
# suite: service test nodePort
|
||||
# templates:
|
||||
# - common.yaml
|
||||
# chart:
|
||||
# appVersion: &appVer v1.2.3
|
||||
# tests:
|
||||
# - it: should pass with default values
|
||||
# documentIndex: &deploymentDoc 0
|
||||
# asserts:
|
||||
# - hasDocuments:
|
||||
# count: 2
|
||||
# - isKind:
|
||||
# of: Deployment
|
||||
|
||||
# - it: should fail with invalid externalTrafficPolicy
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: LoadBalancer
|
||||
# externalTrafficPolicy: invalid_traffic_policy
|
||||
# asserts:
|
||||
# - failedTemplate:
|
||||
# errorMessage: Invalid option (invalid_traffic_policy) for <externalTrafficPolicy>. Valid options are Cluster and Local
|
||||
|
||||
# - it: should fail with invalid sessionAffinity
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# sessionAffinity: invalid_affinity
|
||||
# asserts:
|
||||
# - failedTemplate:
|
||||
# errorMessage: Invalid option (invalid_affinity). Valid options are ClientIP and None
|
||||
|
||||
# - it: should fail with invalid timeoutSeconds in sessionAffinityConfig negative
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# sessionAffinity: ClientIP
|
||||
# sessionAffinityConfig:
|
||||
# clientIP:
|
||||
# timeoutSeconds: -1
|
||||
# asserts:
|
||||
# - failedTemplate:
|
||||
# errorMessage: Invalid value (-1) for <sessionAffinityConfig.ClientIP.timeoutSeconds>. Valid values must be with 0 and 86400
|
||||
|
||||
# - it: should fail with invalid timeoutSeconds in sessionAffinityConfig too high
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# sessionAffinity: ClientIP
|
||||
# sessionAffinityConfig:
|
||||
# clientIP:
|
||||
# timeoutSeconds: 86401
|
||||
# asserts:
|
||||
# - failedTemplate:
|
||||
# errorMessage: Invalid value (86401) for <sessionAffinityConfig.ClientIP.timeoutSeconds>. Valid values must be with 0 and 86400
|
||||
|
||||
# - it: should fail with invalid ipFamilyPolicy
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# ipFamilyPolicy: invalid_fam_policy
|
||||
# asserts:
|
||||
# - failedTemplate:
|
||||
# errorMessage: Invalid option (invalid_fam_policy) for <ipFamilyPolicy>. Valid options are SingleStack, PreferDualStack, RequireDualStack
|
||||
|
||||
# - it: should fail with invalid ipFamily
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# ipFamilies:
|
||||
# - invalid_family
|
||||
# asserts:
|
||||
# - failedTemplate:
|
||||
# errorMessage: Invalid option (invalid_family) for <ipFamilies[]>. Valid options are IPv4 and IPv6
|
||||
|
||||
# - it: should fail with externalIP type but no externalIP defined
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ExternalIP
|
||||
# externalIP: []
|
||||
# asserts:
|
||||
# - failedTemplate:
|
||||
# errorMessage: Service type is set to ExternalIP, but no externalIP is defined.
|
||||
|
||||
# - it: should pass with correct apiVersion
|
||||
# documentIndex: &serviceDoc 1
|
||||
# asserts:
|
||||
# - isKind:
|
||||
# of: Service
|
||||
# - isAPIVersion:
|
||||
# of: v1
|
||||
|
||||
# - it: should pass with correct name
|
||||
# documentIndex: *serviceDoc
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: metadata.name
|
||||
# value: RELEASE-NAME-common-test
|
||||
|
||||
# - it: should pass with nameOverride on other service
|
||||
# documentIndex: &otherServiceDoc 2
|
||||
# set:
|
||||
# service:
|
||||
# other:
|
||||
# enabled: true
|
||||
# nameOverride: something
|
||||
# ports:
|
||||
# other:
|
||||
# enabled: true
|
||||
# port: 80
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: metadata.name
|
||||
# value: RELEASE-NAME-common-test-something
|
||||
|
||||
# - it: should pass with addAnnotations set to true
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# addAnnotations:
|
||||
# traefik: true
|
||||
# metallb: true
|
||||
# service:
|
||||
# main:
|
||||
# type: LoadBalancer
|
||||
# ports:
|
||||
# main:
|
||||
# protocol: HTTPS
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: metadata.annotations
|
||||
# value:
|
||||
# traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
# metallb.universe.tf/allow-shared-ip: RELEASE-NAME-common-test
|
||||
|
||||
# - it: should pass with addAnnotations set to false
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# addAnnotations:
|
||||
# traefik: false
|
||||
# metallb: false
|
||||
# service:
|
||||
# main:
|
||||
# type: LoadBalancer
|
||||
# ports:
|
||||
# main:
|
||||
# protocol: HTTPS
|
||||
# asserts:
|
||||
# - isNull:
|
||||
# path: metadata.annotations
|
||||
|
||||
# - it: should pass with addAnnotations set to true and annotations
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# addAnnotations:
|
||||
# traefik: true
|
||||
# metallb: true
|
||||
# service:
|
||||
# main:
|
||||
# type: LoadBalancer
|
||||
# annotations:
|
||||
# some_key: value
|
||||
# some_key1: value1
|
||||
# ports:
|
||||
# main:
|
||||
# protocol: HTTPS
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: metadata.annotations
|
||||
# value:
|
||||
# traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
# metallb.universe.tf/allow-shared-ip: RELEASE-NAME-common-test
|
||||
# some_key: value
|
||||
# some_key1: value1
|
||||
|
||||
# - it: should pass with addAnnotations set to true and global annotations
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# global:
|
||||
# annotations:
|
||||
# some_key: value
|
||||
# some_key1: value1
|
||||
# addAnnotations:
|
||||
# traefik: true
|
||||
# metallb: true
|
||||
# service:
|
||||
# main:
|
||||
# type: LoadBalancer
|
||||
# ports:
|
||||
# main:
|
||||
# protocol: HTTPS
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: metadata.annotations
|
||||
# value:
|
||||
# traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
# metallb.universe.tf/allow-shared-ip: RELEASE-NAME-common-test
|
||||
# some_key: value
|
||||
# some_key1: value1
|
||||
|
||||
# - it: should pass with labels
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# labels:
|
||||
# some_key: value
|
||||
# some_key1: value1
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: metadata.labels
|
||||
# value:
|
||||
# app: common-test
|
||||
# app.kubernetes.io/instance: RELEASE-NAME
|
||||
# app.kubernetes.io/managed-by: Helm
|
||||
# app.kubernetes.io/name: common-test
|
||||
# app.kubernetes.io/version: *appVer
|
||||
# helm-revision: "0"
|
||||
# helm.sh/chart: common-test-1.0.0
|
||||
# release: RELEASE-NAME
|
||||
# some_key: value
|
||||
# some_key1: value1
|
||||
|
||||
# - it: should pass with labels and global labels
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# global:
|
||||
# labels:
|
||||
# some_key2: value2
|
||||
# some_key3: value3
|
||||
# service:
|
||||
# main:
|
||||
# labels:
|
||||
# some_key: value
|
||||
# some_key1: value1
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: metadata.labels
|
||||
# value:
|
||||
# app: common-test
|
||||
# app.kubernetes.io/instance: RELEASE-NAME
|
||||
# app.kubernetes.io/managed-by: Helm
|
||||
# app.kubernetes.io/name: common-test
|
||||
# app.kubernetes.io/version: *appVer
|
||||
# helm-revision: "0"
|
||||
# helm.sh/chart: common-test-1.0.0
|
||||
# release: RELEASE-NAME
|
||||
# some_key: value
|
||||
# some_key1: value1
|
||||
# some_key2: value2
|
||||
# some_key3: value3
|
||||
|
||||
# - it: should pass with ClusterIP service type
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: &defaultPort
|
||||
# - name: main
|
||||
# port: 65535
|
||||
# protocol: TCP
|
||||
# targetPort: main
|
||||
# selector: &defaultSelector
|
||||
# app: common-test
|
||||
# app.kubernetes.io/instance: RELEASE-NAME
|
||||
# app.kubernetes.io/name: common-test
|
||||
# release: RELEASE-NAME
|
||||
|
||||
# - it: should pass with ClusterIP service type and clusterIP set
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# clusterIP: 172.16.0.12
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# clusterIP: 172.16.0.12
|
||||
# ports: *defaultPort
|
||||
# selector: *defaultSelector
|
||||
|
||||
# - it: should pass with ClusterIP service type and externalTrafficPolicy
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# externalTrafficPolicy: Cluster
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector: *defaultSelector
|
||||
# - isNull:
|
||||
# path: spec.externalTrafficPolicy
|
||||
|
||||
# - it: should pass with ClusterIP service type and sessionAffinity set to None
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# sessionAffinity: None
|
||||
# sessionAffinityConfig:
|
||||
# ClientIP:
|
||||
# timeoutSeconds: 1000
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector: *defaultSelector
|
||||
# sessionAffinity: None
|
||||
# - isNull:
|
||||
# path: spec.sessionAffinityConfig
|
||||
|
||||
# - it: should pass with ClusterIP service type and sessionAffinity set to ClientIP
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# sessionAffinity: ClientIP
|
||||
# sessionAffinityConfig:
|
||||
# clientIP:
|
||||
# timeoutSeconds: 1000
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector: *defaultSelector
|
||||
# sessionAffinity: ClientIP
|
||||
# sessionAffinityConfig:
|
||||
# clientIP:
|
||||
# timeoutSeconds: 1000
|
||||
|
||||
# - it: should pass with ClusterIP service type and sessionAffinity set to ClientIP from tpl
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# timeout: 1000
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# sessionAffinity: ClientIP
|
||||
# sessionAffinityConfig:
|
||||
# clientIP:
|
||||
# timeoutSeconds: 1000
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector: *defaultSelector
|
||||
# sessionAffinity: ClientIP
|
||||
# sessionAffinityConfig:
|
||||
# clientIP:
|
||||
# timeoutSeconds: 1000
|
||||
|
||||
# - it: should pass with ClusterIP service type and externalIPs
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# externalIPs:
|
||||
# - 192.168.1.20
|
||||
# - 192.168.1.21
|
||||
# - 192.168.1.22
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector: *defaultSelector
|
||||
# externalIPs:
|
||||
# - 192.168.1.20
|
||||
# - 192.168.1.21
|
||||
# - 192.168.1.22
|
||||
|
||||
# - it: should pass with ClusterIP service type and externalIPs from tpl
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# ip1: 192.168.1.20
|
||||
# ip2: 192.168.1.21
|
||||
# ip3: 192.168.1.22
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# externalIPs:
|
||||
# - "{{ .Values.ip1 }}"
|
||||
# - "{{ .Values.ip2 }}"
|
||||
# - "{{ .Values.ip3 }}"
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector: *defaultSelector
|
||||
# externalIPs:
|
||||
# - 192.168.1.20
|
||||
# - 192.168.1.21
|
||||
# - 192.168.1.22
|
||||
|
||||
# - it: should pass with ClusterIP service type and publishNotReadyAddresses
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# publishNotReadyAddresses: true
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector: *defaultSelector
|
||||
# publishNotReadyAddresses: true
|
||||
|
||||
# - it: should pass with ClusterIP service type and ipFamilyPolicy
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# ipFamilyPolicy: SingleStack
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector: *defaultSelector
|
||||
# ipFamilyPolicy: SingleStack
|
||||
|
||||
# - it: should pass with ClusterIP service type and ipFamilies
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# ipFamilies:
|
||||
# - IPv6
|
||||
# - IPv4
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector: *defaultSelector
|
||||
# ipFamilies:
|
||||
# - IPv6
|
||||
# - IPv4
|
||||
|
||||
# - it: should pass with ClusterIP service type and custom selector
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# selector:
|
||||
# some_key: some_value
|
||||
# some_key1: some_value1
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector:
|
||||
# some_key: some_value
|
||||
# some_key1: some_value1
|
||||
|
||||
# - it: should pass with ClusterIP service type and custom selector from tpl
|
||||
# documentIndex: *serviceDoc
|
||||
# set:
|
||||
# k1: some_value
|
||||
# k2: some_value1
|
||||
# service:
|
||||
# main:
|
||||
# type: ClusterIP
|
||||
# selector:
|
||||
# some_key: "{{ .Values.k1 }}"
|
||||
# some_key1: "{{ .Values.k2 }}"
|
||||
# asserts:
|
||||
# - equal:
|
||||
# path: spec
|
||||
# value:
|
||||
# type: ClusterIP
|
||||
# ports: *defaultPort
|
||||
# selector:
|
||||
# some_key: some_value
|
||||
# some_key1: some_value1
|
||||
Reference in New Issue
Block a user