validation_test.yaml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. suite: cronjob validation test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should fail with invalid concurrencyPolicy
  6. set:
  7. workload:
  8. workload-name:
  9. enabled: true
  10. primary: true
  11. type: CronJob
  12. concurrencyPolicy: not-a-policy
  13. podSpec: {}
  14. asserts:
  15. - failedTemplate:
  16. errorMessage: CronJob - Expected <concurrencyPolicy> to be one of [Allow, Forbid, Replace], but got [not-a-policy]
  17. - it: should fail with empty schedule
  18. set:
  19. workload:
  20. workload-name:
  21. enabled: true
  22. primary: true
  23. type: CronJob
  24. schedule:
  25. podSpec: {}
  26. asserts:
  27. - failedTemplate:
  28. errorMessage: CronJob - Expected non-empty <schedule>
  29. - it: should fail with restartPolicy set to Always
  30. set:
  31. workload:
  32. workload-name:
  33. enabled: true
  34. primary: true
  35. type: CronJob
  36. schedule: "* * * * *"
  37. restartPolicy: Always
  38. podSpec: {}
  39. asserts:
  40. - failedTemplate:
  41. errorMessage: Expected <restartPolicy to be [OnFailure, Never] for [CronJob] but got [Always]
  42. - it: should fail with invalid completionMode (make sure job validation kicks in)
  43. set:
  44. workload:
  45. workload-name:
  46. enabled: true
  47. primary: true
  48. type: CronJob
  49. schedule: "* * * * *"
  50. completionMode: not-a-mode
  51. podSpec: {}
  52. asserts:
  53. - failedTemplate:
  54. errorMessage: Job - Expected <completionMode> to be one of [Indexed, NonIndexed], but got [not-a-mode]