spec_test.yaml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. startingDeadlineSeconds:
  32. - documentIndex: *cronJobDoc
  33. isSubset:
  34. path: spec.jobTemplate.spec
  35. content:
  36. backoffLimit: 5
  37. completionMode: NonIndexed
  38. completions:
  39. parallelism: 1
  40. ttlSecondsAfterFinished: 120
  41. - it: should apply spec correctly
  42. set:
  43. cron: "*/5 * * * *"
  44. someTimezone: America/New_York
  45. workload:
  46. workload-name:
  47. enabled: true
  48. primary: true
  49. type: CronJob
  50. schedule: "{{ .Values.cron }}"
  51. timezone: "{{ .Values.someTimezone }}"
  52. concurrencyPolicy: Allow
  53. failedJobsHistoryLimit: 2
  54. successfulJobsHistoryLimit: 4
  55. startingDeadlineSeconds: 100
  56. backoffLimit: 5
  57. completionMode: Indexed
  58. completions: 5
  59. parallelism: 5
  60. ttlSecondsAfterFinished: 100
  61. activeDeadlineSeconds: 100
  62. podSpec:
  63. restartPolicy: Never
  64. asserts:
  65. - documentIndex: *cronJobDoc
  66. isSubset:
  67. path: spec
  68. content:
  69. schedule: "*/5 * * * *"
  70. concurrencyPolicy: Allow
  71. failedJobsHistoryLimit: 2
  72. successfulJobsHistoryLimit: 4
  73. startingDeadlineSeconds: 100
  74. timeZone: America/New_York
  75. - documentIndex: *cronJobDoc
  76. isSubset:
  77. path: spec.jobTemplate.spec
  78. content:
  79. backoffLimit: 5
  80. completionMode: Indexed
  81. completions: 5
  82. parallelism: 5
  83. ttlSecondsAfterFinished: 100
  84. activeDeadlineSeconds: 100