spec_test.yaml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. suite: cronjob spec test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should pass with workload enabled
  6. set:
  7. workload:
  8. workload-name:
  9. enabled: true
  10. primary: true
  11. type: CronJob
  12. schedule: "* * * * *"
  13. podSpec:
  14. restartPolicy: Never
  15. asserts:
  16. - documentIndex: &cronJobDoc 0
  17. isKind:
  18. of: CronJob
  19. - documentIndex: *cronJobDoc
  20. isAPIVersion:
  21. of: batch/v1
  22. - documentIndex: *cronJobDoc
  23. isSubset:
  24. path: spec
  25. content:
  26. schedule: "* * * * *"
  27. timeZone: UTC
  28. concurrencyPolicy: Forbid
  29. failedJobsHistoryLimit: 1
  30. successfulJobsHistoryLimit: 3
  31. suspend: false
  32. startingDeadlineSeconds:
  33. - documentIndex: *cronJobDoc
  34. isSubset:
  35. path: spec.jobTemplate.spec
  36. content:
  37. backoffLimit: 5
  38. completionMode: NonIndexed
  39. completions:
  40. parallelism: 1
  41. ttlSecondsAfterFinished: 120
  42. - it: should apply spec correctly
  43. set:
  44. cron: "*/5 * * * *"
  45. someTimezone: America/New_York
  46. workload:
  47. workload-name:
  48. enabled: true
  49. primary: true
  50. type: CronJob
  51. schedule: "{{ .Values.cron }}"
  52. timezone: "{{ .Values.someTimezone }}"
  53. concurrencyPolicy: Allow
  54. failedJobsHistoryLimit: 2
  55. successfulJobsHistoryLimit: 4
  56. startingDeadlineSeconds: 100
  57. backoffLimit: 5
  58. completionMode: Indexed
  59. completions: 5
  60. parallelism: 5
  61. ttlSecondsAfterFinished: 100
  62. activeDeadlineSeconds: 100
  63. podSpec:
  64. restartPolicy: Never
  65. asserts:
  66. - documentIndex: *cronJobDoc
  67. isSubset:
  68. path: spec
  69. content:
  70. schedule: "*/5 * * * *"
  71. concurrencyPolicy: Allow
  72. failedJobsHistoryLimit: 2
  73. successfulJobsHistoryLimit: 4
  74. startingDeadlineSeconds: 100
  75. timeZone: America/New_York
  76. - documentIndex: *cronJobDoc
  77. isSubset:
  78. path: spec.jobTemplate.spec
  79. content:
  80. backoffLimit: 5
  81. completionMode: Indexed
  82. completions: 5
  83. parallelism: 5
  84. ttlSecondsAfterFinished: 100
  85. activeDeadlineSeconds: 100
  86. - it: should set suspend to true
  87. set:
  88. workload:
  89. workload-name:
  90. enabled: true
  91. primary: true
  92. type: CronJob
  93. schedule: "*/5 * * * *"
  94. suspend: true
  95. podSpec:
  96. restartPolicy: Never
  97. asserts:
  98. - documentIndex: *cronJobDoc
  99. isSubset:
  100. path: spec
  101. content:
  102. schedule: "*/5 * * * *"
  103. timeZone: UTC
  104. suspend: true
  105. - it: should set suspend to true on ixChartContext - isStopped (true)
  106. set:
  107. global:
  108. ixChartContext:
  109. storageClassName: some-storage-class
  110. isStopped: true
  111. workload:
  112. workload-name:
  113. enabled: true
  114. primary: true
  115. type: CronJob
  116. schedule: "*/5 * * * *"
  117. suspend: false
  118. podSpec:
  119. restartPolicy: Never
  120. asserts:
  121. - documentIndex: *cronJobDoc
  122. isSubset:
  123. path: spec
  124. content:
  125. schedule: "*/5 * * * *"
  126. timeZone: UTC
  127. suspend: true
  128. - it: should not set suspend to true on ixChartContext - isStopped (false)
  129. set:
  130. global:
  131. ixChartContext:
  132. storageClassName: some-storage-class
  133. isStopped: false
  134. workload:
  135. workload-name:
  136. enabled: true
  137. primary: true
  138. type: CronJob
  139. schedule: "*/5 * * * *"
  140. suspend: false
  141. podSpec:
  142. restartPolicy: Never
  143. asserts:
  144. - documentIndex: *cronJobDoc
  145. isSubset:
  146. path: spec
  147. content:
  148. schedule: "*/5 * * * *"
  149. timeZone: UTC
  150. suspend: false