ports_test.yaml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. suite: container ports test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should create the correct ports without selector
  6. set:
  7. some_port: 80
  8. image: &image
  9. repository: nginx
  10. tag: 1.19.0
  11. pullPolicy: IfNotPresent
  12. workload:
  13. workload-name1:
  14. enabled: true
  15. primary: true
  16. type: Deployment
  17. podSpec:
  18. containers:
  19. container-name1:
  20. enabled: true
  21. primary: true
  22. imageSelector: image
  23. probes: &probes
  24. liveness:
  25. enabled: false
  26. readiness:
  27. enabled: false
  28. startup:
  29. enabled: false
  30. workload-name2:
  31. enabled: true
  32. primary: false
  33. type: Deployment
  34. podSpec:
  35. containers:
  36. container-name1:
  37. enabled: true
  38. primary: true
  39. imageSelector: image
  40. probes: *probes
  41. service:
  42. my-service1:
  43. enabled: true
  44. primary: true
  45. ports:
  46. port-name:
  47. enabled: true
  48. primary: true
  49. port: "{{ .Values.some_port }}"
  50. asserts:
  51. - documentIndex: &deploymentDoc 0
  52. isKind:
  53. of: Deployment
  54. - documentIndex: *deploymentDoc
  55. isAPIVersion:
  56. of: apps/v1
  57. - documentIndex: *deploymentDoc
  58. isSubset:
  59. path: spec.template.spec.containers[0]
  60. content:
  61. ports:
  62. - name: port-name
  63. containerPort: 80
  64. protocol: TCP
  65. - documentIndex: &otherDeploymentDoc 1
  66. isKind:
  67. of: Deployment
  68. - documentIndex: *otherDeploymentDoc
  69. isNull:
  70. path: spec.template.spec.containers[0].ports
  71. - it: should create the correct ports with selector
  72. set:
  73. some_port: 53
  74. image: &image
  75. repository: nginx
  76. tag: 1.19.0
  77. pullPolicy: IfNotPresent
  78. workload:
  79. workload-name1:
  80. enabled: true
  81. primary: true
  82. type: Deployment
  83. podSpec:
  84. containers:
  85. container-name1:
  86. enabled: true
  87. primary: true
  88. imageSelector: image
  89. probes: *probes
  90. workload-name2:
  91. enabled: true
  92. primary: false
  93. type: Deployment
  94. podSpec:
  95. containers:
  96. container-name1:
  97. enabled: true
  98. primary: true
  99. imageSelector: image
  100. probes: *probes
  101. service:
  102. my-service1:
  103. enabled: true
  104. primary: true
  105. targetSelector: workload-name1
  106. ports:
  107. port-name:
  108. enabled: true
  109. primary: true
  110. targetSelector: container-name1
  111. port: 1234
  112. my-service2:
  113. enabled: true
  114. primary: false
  115. targetSelector: workload-name2
  116. ports:
  117. port-name:
  118. enabled: true
  119. primary: true
  120. targetSelector: container-name1
  121. port: 54
  122. targetPort: "{{ .Values.some_port }}"
  123. asserts:
  124. - documentIndex: &deploymentDoc 0
  125. isKind:
  126. of: Deployment
  127. - documentIndex: *deploymentDoc
  128. isAPIVersion:
  129. of: apps/v1
  130. - documentIndex: *deploymentDoc
  131. isSubset:
  132. path: spec.template.spec.containers[0]
  133. content:
  134. ports:
  135. - name: port-name
  136. containerPort: 1234
  137. protocol: TCP
  138. - documentIndex: &otherDeploymentDoc 1
  139. isKind:
  140. of: Deployment
  141. - documentIndex: *otherDeploymentDoc
  142. isSubset:
  143. path: spec.template.spec.containers[0]
  144. content:
  145. ports:
  146. - name: port-name
  147. containerPort: 53
  148. protocol: TCP
  149. - it: should create the correct ports with hostPort
  150. set:
  151. image: &image
  152. repository: nginx
  153. tag: 1.19.0
  154. pullPolicy: IfNotPresent
  155. workload:
  156. workload-name1:
  157. enabled: true
  158. primary: true
  159. type: Deployment
  160. podSpec:
  161. containers:
  162. container-name1:
  163. enabled: true
  164. primary: true
  165. imageSelector: image
  166. probes: *probes
  167. service:
  168. my-service1:
  169. enabled: true
  170. primary: true
  171. ports:
  172. port-name:
  173. enabled: true
  174. primary: true
  175. port: 1234
  176. targetPort: 5678
  177. hostPort: 20000
  178. asserts:
  179. - documentIndex: &deploymentDoc 0
  180. isKind:
  181. of: Deployment
  182. - documentIndex: *deploymentDoc
  183. isAPIVersion:
  184. of: apps/v1
  185. - documentIndex: *deploymentDoc
  186. isSubset:
  187. path: spec.template.spec.containers[0]
  188. content:
  189. ports:
  190. - name: port-name
  191. containerPort: 5678
  192. protocol: TCP
  193. hostPort: 20000
  194. - it: should create the correct protocol from tpl
  195. set:
  196. some_protocol: https
  197. image: &image
  198. repository: nginx
  199. tag: 1.19.0
  200. pullPolicy: IfNotPresent
  201. workload:
  202. workload-name1:
  203. enabled: true
  204. primary: true
  205. type: Deployment
  206. podSpec:
  207. containers:
  208. container-name1:
  209. enabled: true
  210. primary: true
  211. imageSelector: image
  212. probes: *probes
  213. service:
  214. my-service1:
  215. enabled: true
  216. primary: true
  217. ports:
  218. port-name:
  219. enabled: true
  220. primary: true
  221. port: 1234
  222. protocol: "{{ .Values.some_protocol }}"
  223. asserts:
  224. - documentIndex: &deploymentDoc 0
  225. isKind:
  226. of: Deployment
  227. - documentIndex: *deploymentDoc
  228. isAPIVersion:
  229. of: apps/v1
  230. - documentIndex: *deploymentDoc
  231. isSubset:
  232. path: spec.template.spec.containers[0]
  233. content:
  234. ports:
  235. - name: port-name
  236. containerPort: 1234
  237. protocol: TCP
  238. - it: should create the correct protocol
  239. set:
  240. image: &image
  241. repository: nginx
  242. tag: 1.19.0
  243. pullPolicy: IfNotPresent
  244. workload:
  245. workload-name1:
  246. enabled: true
  247. primary: true
  248. type: Deployment
  249. podSpec:
  250. containers:
  251. container-name1:
  252. enabled: true
  253. primary: true
  254. imageSelector: image
  255. probes: *probes
  256. service:
  257. my-service1:
  258. enabled: true
  259. primary: true
  260. ports:
  261. port-name:
  262. enabled: true
  263. primary: true
  264. port: 1234
  265. protocol: udp
  266. asserts:
  267. - documentIndex: &deploymentDoc 0
  268. isKind:
  269. of: Deployment
  270. - documentIndex: *deploymentDoc
  271. isAPIVersion:
  272. of: apps/v1
  273. - documentIndex: *deploymentDoc
  274. isSubset:
  275. path: spec.template.spec.containers[0]
  276. content:
  277. ports:
  278. - name: port-name
  279. containerPort: 1234
  280. protocol: UDP