node_port_test.yaml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. suite: service nodePort test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should pass with type nodePort
  6. set:
  7. service:
  8. my-service:
  9. enabled: true
  10. primary: true
  11. type: NodePort
  12. ports:
  13. port-name:
  14. enabled: true
  15. primary: true
  16. port: 12345
  17. nodePort: 30000
  18. workload:
  19. my-workload:
  20. enabled: true
  21. primary: true
  22. type: Deployment
  23. podSpec: {}
  24. asserts:
  25. - documentIndex: &serviceDoc 1
  26. isKind:
  27. of: Service
  28. - documentIndex: *serviceDoc
  29. isAPIVersion:
  30. of: v1
  31. - documentIndex: *serviceDoc
  32. equal:
  33. path: metadata.name
  34. value: release-name-common-test
  35. - documentIndex: *serviceDoc
  36. equal:
  37. path: spec
  38. value:
  39. type: NodePort
  40. publishNotReadyAddresses: false
  41. ports:
  42. - name: port-name
  43. port: 12345
  44. protocol: TCP
  45. targetPort: 12345
  46. nodePort: 30000
  47. selector:
  48. app.kubernetes.io/instance: RELEASE-NAME
  49. app.kubernetes.io/name: common-test
  50. pod.name: my-workload
  51. - it: should pass with type NodePort and hostnetwork enabled
  52. set:
  53. service:
  54. my-service:
  55. enabled: true
  56. primary: true
  57. type: NodePort
  58. ports:
  59. port-name:
  60. enabled: true
  61. primary: true
  62. port: 12345
  63. nodePort: 30000
  64. workload:
  65. my-workload:
  66. enabled: true
  67. primary: true
  68. type: Deployment
  69. podSpec:
  70. hostNetwork: true
  71. asserts:
  72. - documentIndex: &serviceDoc 1
  73. isKind:
  74. of: Service
  75. - documentIndex: *serviceDoc
  76. isAPIVersion:
  77. of: v1
  78. - documentIndex: *serviceDoc
  79. equal:
  80. path: metadata.name
  81. value: release-name-common-test
  82. - documentIndex: *serviceDoc
  83. equal:
  84. path: spec
  85. value:
  86. type: ClusterIP
  87. publishNotReadyAddresses: false
  88. ports:
  89. - name: port-name
  90. port: 12345
  91. protocol: TCP
  92. targetPort: 12345
  93. selector:
  94. app.kubernetes.io/instance: RELEASE-NAME
  95. app.kubernetes.io/name: common-test
  96. pod.name: my-workload
  97. - documentIndex: *serviceDoc
  98. isNull:
  99. path: spec.ports[0].nodePort
  100. - it: should pass with type NodePort and available options set
  101. set:
  102. some_ip: 172.16.20.35
  103. some_family: IPv6
  104. some_policy: Local
  105. some_other_ip: 10.200.34.53
  106. some_affinity: ClientIP
  107. some_timeout: 100
  108. some_port: 12344
  109. some_target_port: 12346
  110. some_protocol: http
  111. some_nodePort: 30001
  112. service:
  113. my-service:
  114. enabled: true
  115. primary: true
  116. type: NodePort
  117. clusterIP: "{{ .Values.some_ip }}"
  118. externalTrafficPolicy: "{{ .Values.some_policy }}"
  119. publishNotReadyAddresses: true
  120. ipFamilyPolicy: PreferDualStack
  121. ipFamilies:
  122. - IPv4
  123. - "{{ .Values.some_family }}"
  124. externalIPs:
  125. - "{{ .Values.some_other_ip }}"
  126. - 10.200.34.54
  127. sessionAffinity: "{{ .Values.some_affinity }}"
  128. sessionAffinityConfig:
  129. clientIP:
  130. timeoutSeconds: "{{ .Values.some_timeout }}"
  131. ports:
  132. port-name:
  133. enabled: true
  134. primary: true
  135. port: 12345
  136. nodePort: 30000
  137. port-name2:
  138. enabled: true
  139. port: "{{ .Values.some_port }}"
  140. targetPort: "{{ .Values.some_target_port }}"
  141. protocol: "{{ .Values.some_protocol }}"
  142. nodePort: "{{ .Values.some_nodePort }}"
  143. workload:
  144. my-workload:
  145. enabled: true
  146. primary: true
  147. type: Deployment
  148. podSpec: {}
  149. asserts:
  150. - documentIndex: *serviceDoc
  151. equal:
  152. path: spec
  153. value:
  154. type: NodePort
  155. clusterIP: 172.16.20.35
  156. externalTrafficPolicy: Local
  157. ipFamilyPolicy: PreferDualStack
  158. publishNotReadyAddresses: true
  159. ipFamilies:
  160. - IPv4
  161. - IPv6
  162. externalIPs:
  163. - 10.200.34.53
  164. - 10.200.34.54
  165. sessionAffinity: ClientIP
  166. sessionAffinityConfig:
  167. clientIP:
  168. timeoutSeconds: 100
  169. ports:
  170. - name: port-name
  171. port: 12345
  172. protocol: TCP
  173. targetPort: 12345
  174. nodePort: 30000
  175. - name: port-name2
  176. port: 12344
  177. protocol: TCP
  178. targetPort: 12346
  179. nodePort: 30001
  180. selector:
  181. app.kubernetes.io/instance: RELEASE-NAME
  182. app.kubernetes.io/name: common-test
  183. pod.name: my-workload