data_upgrade_test.yaml 5.5 KB

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