data_test.yaml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. suite: init container data test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should generate correct init container
  6. set:
  7. initType: install
  8. render: true
  9. persistence:
  10. shared-vol:
  11. enabled: true
  12. type: emptyDir
  13. mountPath: /some/path
  14. targetSelector:
  15. workload-name:
  16. container-name2: {}
  17. image:
  18. repository: nginx
  19. tag: 1.19.0
  20. pullPolicy: IfNotPresent
  21. initImage:
  22. repository: bash
  23. tag: latest
  24. pullPolicy: IfNotPresent
  25. workload:
  26. workload-name:
  27. enabled: true
  28. primary: true
  29. type: Deployment
  30. podSpec:
  31. containers:
  32. container-name1:
  33. enabled: true
  34. primary: true
  35. imageSelector: image
  36. probes:
  37. liveness:
  38. enabled: false
  39. readiness:
  40. enabled: false
  41. startup:
  42. enabled: false
  43. initContainers:
  44. container-name1:
  45. enabled: "{{ .Values.render }}"
  46. type: init
  47. imageSelector: initImage
  48. env:
  49. key: value
  50. key2: "{{ .Values.initImage.repository }}"
  51. key3:
  52. secretKeyRef:
  53. expandObjectName: false
  54. name: '{{ printf "secret-name" }}'
  55. key: secret-key
  56. container-name3:
  57. enabled: true
  58. type: upgrade
  59. imageSelector: initImage
  60. container-name2:
  61. enabled: true
  62. type: "{{ .Values.initType }}"
  63. imageSelector: initImage
  64. probes:
  65. liveness:
  66. enabled: true
  67. readiness:
  68. enabled: true
  69. startup:
  70. enabled: true
  71. command:
  72. - /bin/sh
  73. - -c
  74. - |
  75. echo "Using image {{ .Values.initImage.repository }}"
  76. asserts:
  77. - documentIndex: &deploymentDoc 0
  78. isKind:
  79. of: Deployment
  80. - documentIndex: *deploymentDoc
  81. isAPIVersion:
  82. of: apps/v1
  83. - documentIndex: *deploymentDoc
  84. isSubset:
  85. path: spec.template.spec.initContainers[0]
  86. content:
  87. name: release-name-common-test-install-container-name2
  88. image: bash:latest
  89. command:
  90. - /bin/sh
  91. - -c
  92. - |
  93. echo "Using image bash"
  94. volumeMounts:
  95. - name: shared-vol
  96. mountPath: /some/path
  97. readOnly: false
  98. - documentIndex: *deploymentDoc
  99. isNull:
  100. path: spec.template.spec.initContainers[0].livenessProbe
  101. - documentIndex: *deploymentDoc
  102. isNull:
  103. path: spec.template.spec.initContainers[0].readinessProbe
  104. - documentIndex: *deploymentDoc
  105. isNull:
  106. path: spec.template.spec.initContainers[0].startupProbe
  107. - documentIndex: *deploymentDoc
  108. isSubset:
  109. path: spec.template.spec.initContainers[1]
  110. content:
  111. name: release-name-common-test-init-container-name1
  112. - documentIndex: *deploymentDoc
  113. isSubset:
  114. path: spec.template.spec.initContainers[1]
  115. content:
  116. env:
  117. - name: "TZ"
  118. value: "UTC"
  119. - name: "UMASK"
  120. value: "002"
  121. - name: "UMASK_SET"
  122. value: "002"
  123. - name: NVIDIA_VISIBLE_DEVICES
  124. value: "void"
  125. - name: "S6_READ_ONLY_ROOT"
  126. value: "1"
  127. - name: "key"
  128. value: "value"
  129. - name: "key2"
  130. value: "bash"
  131. - name: "key3"
  132. valueFrom:
  133. secretKeyRef:
  134. key: "secret-key"
  135. name: "secret-name"
  136. - documentIndex: *deploymentDoc
  137. isNull:
  138. path: spec.template.spec.initContainers[1].command
  139. - documentIndex: *deploymentDoc
  140. isNull:
  141. path: spec.template.spec.initContainers[1].volumeMounts
  142. - documentIndex: *deploymentDoc
  143. isNull:
  144. path: spec.template.spec.initContainers[2]
  145. - it: should NOT generate render init container
  146. set:
  147. render: false
  148. image:
  149. repository: nginx
  150. tag: 1.19.0
  151. pullPolicy: IfNotPresent
  152. workload:
  153. workload-name:
  154. enabled: true
  155. primary: true
  156. type: Deployment
  157. podSpec:
  158. containers:
  159. container-name1:
  160. enabled: true
  161. primary: true
  162. imageSelector: image
  163. probes:
  164. liveness:
  165. enabled: false
  166. readiness:
  167. enabled: false
  168. startup:
  169. enabled: false
  170. initContainers:
  171. container-name1:
  172. enabled: "{{ .Values.render }}"
  173. type: init
  174. imageSelector: image
  175. asserts:
  176. - documentIndex: &deploymentDoc 0
  177. isKind:
  178. of: Deployment
  179. - documentIndex: *deploymentDoc
  180. isAPIVersion:
  181. of: apps/v1
  182. - documentIndex: *deploymentDoc
  183. isNull:
  184. path: spec.template.spec.initContainers