spec_test.yaml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. asserts:
  15. - documentIndex: &cronJobDoc 0
  16. isKind:
  17. of: CronJob
  18. - documentIndex: *cronJobDoc
  19. isAPIVersion:
  20. of: batch/v1
  21. - documentIndex: *cronJobDoc
  22. isSubset:
  23. path: spec
  24. content:
  25. schedule: "* * * * *"
  26. timeZone: UTC
  27. concurrencyPolicy: Forbid
  28. failedJobsHistoryLimit: 1
  29. successfulJobsHistoryLimit: 3
  30. startingDeadlineSeconds:
  31. - documentIndex: *cronJobDoc
  32. isSubset:
  33. path: spec.jobTemplate.spec
  34. content:
  35. backoffLimit: 5
  36. completionMode: NonIndexed
  37. completions:
  38. parallelism: 1
  39. ttlSecondsAfterFinished: 120
  40. - it: should apply spec correctly
  41. set:
  42. cron: "*/5 * * * *"
  43. someTimezone: America/New_York
  44. workload:
  45. workload-name:
  46. enabled: true
  47. primary: true
  48. type: CronJob
  49. schedule: "{{ .Values.cron }}"
  50. timezone: "{{ .Values.someTimezone }}"
  51. concurrencyPolicy: Allow
  52. failedJobsHistoryLimit: 2
  53. successfulJobsHistoryLimit: 4
  54. startingDeadlineSeconds: 100
  55. backoffLimit: 5
  56. completionMode: Indexed
  57. completions: 5
  58. parallelism: 5
  59. ttlSecondsAfterFinished: 100
  60. activeDeadlineSeconds: 100
  61. podSpec: {}
  62. asserts:
  63. - documentIndex: *cronJobDoc
  64. isSubset:
  65. path: spec
  66. content:
  67. schedule: "*/5 * * * *"
  68. concurrencyPolicy: Allow
  69. failedJobsHistoryLimit: 2
  70. successfulJobsHistoryLimit: 4
  71. startingDeadlineSeconds: 100
  72. timeZone: America/New_York
  73. - documentIndex: *cronJobDoc
  74. isSubset:
  75. path: spec.jobTemplate.spec
  76. content:
  77. backoffLimit: 5
  78. completionMode: Indexed
  79. completions: 5
  80. parallelism: 5
  81. ttlSecondsAfterFinished: 100
  82. activeDeadlineSeconds: 100