data_test.yaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. container-name3:
  49. enabled: true
  50. type: upgrade
  51. imageSelector: initImage
  52. container-name2:
  53. enabled: true
  54. type: "{{ .Values.initType }}"
  55. imageSelector: initImage
  56. probes:
  57. liveness:
  58. enabled: true
  59. readiness:
  60. enabled: true
  61. startup:
  62. enabled: true
  63. command:
  64. - /bin/sh
  65. - -c
  66. - |
  67. echo "Using image {{ .Values.initImage.repository }}"
  68. asserts:
  69. - documentIndex: &deploymentDoc 0
  70. isKind:
  71. of: Deployment
  72. - documentIndex: *deploymentDoc
  73. isAPIVersion:
  74. of: apps/v1
  75. - documentIndex: *deploymentDoc
  76. isSubset:
  77. path: spec.template.spec.initContainers[0]
  78. content:
  79. name: release-name-common-test-install-container-name2
  80. image: bash:latest
  81. command:
  82. - /bin/sh
  83. - -c
  84. - |
  85. echo "Using image bash"
  86. volumeMounts:
  87. - name: shared-vol
  88. mountPath: /some/path
  89. readOnly: false
  90. - documentIndex: *deploymentDoc
  91. isNull:
  92. path: spec.template.spec.initContainers[0].livenessProbe
  93. - documentIndex: *deploymentDoc
  94. isNull:
  95. path: spec.template.spec.initContainers[0].readinessProbe
  96. - documentIndex: *deploymentDoc
  97. isNull:
  98. path: spec.template.spec.initContainers[0].startupProbe
  99. - documentIndex: *deploymentDoc
  100. isSubset:
  101. path: spec.template.spec.initContainers[1]
  102. content:
  103. name: release-name-common-test-init-container-name1
  104. - documentIndex: *deploymentDoc
  105. isNull:
  106. path: spec.template.spec.initContainers[1].command
  107. - documentIndex: *deploymentDoc
  108. isNull:
  109. path: spec.template.spec.initContainers[1].volumeMounts
  110. - documentIndex: *deploymentDoc
  111. isNull:
  112. path: spec.template.spec.initContainers[2]
  113. - it: should NOT generate render init container
  114. set:
  115. render: false
  116. image:
  117. repository: nginx
  118. tag: 1.19.0
  119. pullPolicy: IfNotPresent
  120. workload:
  121. workload-name:
  122. enabled: true
  123. primary: true
  124. type: Deployment
  125. podSpec:
  126. containers:
  127. container-name1:
  128. enabled: true
  129. primary: true
  130. imageSelector: image
  131. probes:
  132. liveness:
  133. enabled: false
  134. readiness:
  135. enabled: false
  136. startup:
  137. enabled: false
  138. initContainers:
  139. container-name1:
  140. enabled: "{{ .Values.render }}"
  141. type: init
  142. imageSelector: image
  143. asserts:
  144. - documentIndex: &deploymentDoc 0
  145. isKind:
  146. of: Deployment
  147. - documentIndex: *deploymentDoc
  148. isAPIVersion:
  149. of: apps/v1
  150. - documentIndex: *deploymentDoc
  151. isNull:
  152. path: spec.template.spec.initContainers