ports_test.yaml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. hostPort: null
  65. protocol: TCP
  66. - documentIndex: &otherDeploymentDoc 1
  67. isKind:
  68. of: Deployment
  69. - documentIndex: *otherDeploymentDoc
  70. isNull:
  71. path: spec.template.spec.containers[0].ports
  72. - it: should create the correct ports with selector
  73. set:
  74. some_port: 53
  75. image: &image
  76. repository: nginx
  77. tag: 1.19.0
  78. pullPolicy: IfNotPresent
  79. workload:
  80. workload-name1:
  81. enabled: true
  82. primary: true
  83. type: Deployment
  84. podSpec:
  85. containers:
  86. container-name1:
  87. enabled: true
  88. primary: true
  89. imageSelector: image
  90. probes: *probes
  91. workload-name2:
  92. enabled: true
  93. primary: false
  94. type: Deployment
  95. podSpec:
  96. containers:
  97. container-name1:
  98. enabled: true
  99. primary: true
  100. imageSelector: image
  101. probes: *probes
  102. service:
  103. my-service1:
  104. enabled: true
  105. primary: true
  106. targetSelector: workload-name1
  107. ports:
  108. port-name:
  109. enabled: true
  110. primary: true
  111. targetSelector: container-name1
  112. port: 1234
  113. my-service2:
  114. enabled: true
  115. primary: false
  116. targetSelector: workload-name2
  117. ports:
  118. port-name:
  119. enabled: true
  120. primary: true
  121. targetSelector: container-name1
  122. port: 54
  123. targetPort: "{{ .Values.some_port }}"
  124. asserts:
  125. - documentIndex: &deploymentDoc 0
  126. isKind:
  127. of: Deployment
  128. - documentIndex: *deploymentDoc
  129. isAPIVersion:
  130. of: apps/v1
  131. - documentIndex: *deploymentDoc
  132. isSubset:
  133. path: spec.template.spec.containers[0]
  134. content:
  135. ports:
  136. - name: port-name
  137. containerPort: 1234
  138. hostPort: null
  139. protocol: TCP
  140. - documentIndex: &otherDeploymentDoc 1
  141. isKind:
  142. of: Deployment
  143. - documentIndex: *otherDeploymentDoc
  144. isSubset:
  145. path: spec.template.spec.containers[0]
  146. content:
  147. ports:
  148. - name: port-name
  149. containerPort: 53
  150. hostPort: null
  151. protocol: TCP
  152. - it: should create the correct ports with hostPort
  153. set:
  154. image: &image
  155. repository: nginx
  156. tag: 1.19.0
  157. pullPolicy: IfNotPresent
  158. workload:
  159. workload-name1:
  160. enabled: true
  161. primary: true
  162. type: Deployment
  163. podSpec:
  164. containers:
  165. container-name1:
  166. enabled: true
  167. primary: true
  168. imageSelector: image
  169. probes: *probes
  170. service:
  171. my-service1:
  172. enabled: true
  173. primary: true
  174. ports:
  175. port-name:
  176. enabled: true
  177. primary: true
  178. port: 1234
  179. targetPort: 5678
  180. hostPort: 20000
  181. asserts:
  182. - documentIndex: &deploymentDoc 0
  183. isKind:
  184. of: Deployment
  185. - documentIndex: *deploymentDoc
  186. isAPIVersion:
  187. of: apps/v1
  188. - documentIndex: *deploymentDoc
  189. isSubset:
  190. path: spec.template.spec.containers[0]
  191. content:
  192. ports:
  193. - name: port-name
  194. containerPort: 5678
  195. protocol: TCP
  196. hostPort: 20000
  197. - it: should create the correct protocol from tpl
  198. set:
  199. some_protocol: https
  200. image: &image
  201. repository: nginx
  202. tag: 1.19.0
  203. pullPolicy: IfNotPresent
  204. workload:
  205. workload-name1:
  206. enabled: true
  207. primary: true
  208. type: Deployment
  209. podSpec:
  210. containers:
  211. container-name1:
  212. enabled: true
  213. primary: true
  214. imageSelector: image
  215. probes: *probes
  216. service:
  217. my-service1:
  218. enabled: true
  219. primary: true
  220. ports:
  221. port-name:
  222. enabled: true
  223. primary: true
  224. port: 1234
  225. protocol: "{{ .Values.some_protocol }}"
  226. asserts:
  227. - documentIndex: &deploymentDoc 0
  228. isKind:
  229. of: Deployment
  230. - documentIndex: *deploymentDoc
  231. isAPIVersion:
  232. of: apps/v1
  233. - documentIndex: *deploymentDoc
  234. isSubset:
  235. path: spec.template.spec.containers[0]
  236. content:
  237. ports:
  238. - name: port-name
  239. containerPort: 1234
  240. hostPort: null
  241. protocol: TCP
  242. - it: should create the correct protocol
  243. set:
  244. image: &image
  245. repository: nginx
  246. tag: 1.19.0
  247. pullPolicy: IfNotPresent
  248. workload:
  249. workload-name1:
  250. enabled: true
  251. primary: true
  252. type: Deployment
  253. podSpec:
  254. containers:
  255. container-name1:
  256. enabled: true
  257. primary: true
  258. imageSelector: image
  259. probes: *probes
  260. service:
  261. my-service1:
  262. enabled: true
  263. primary: true
  264. ports:
  265. port-name:
  266. enabled: true
  267. primary: true
  268. port: 1234
  269. protocol: udp
  270. asserts:
  271. - documentIndex: &deploymentDoc 0
  272. isKind:
  273. of: Deployment
  274. - documentIndex: *deploymentDoc
  275. isAPIVersion:
  276. of: apps/v1
  277. - documentIndex: *deploymentDoc
  278. isSubset:
  279. path: spec.template.spec.containers[0]
  280. content:
  281. ports:
  282. - name: port-name
  283. containerPort: 1234
  284. hostPort: null
  285. protocol: UDP