validation_test.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. suite: workload validation test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should fail with name longer than 63 characters
  6. set:
  7. workload:
  8. workload-name:
  9. enabled: true
  10. primary: true
  11. type: Deployment
  12. podSpec: {}
  13. other-workload-name-super-long-name-that-is-longer-than-63-characters:
  14. enabled: true
  15. primary: false
  16. type: Deployment
  17. podSpec: {}
  18. asserts:
  19. - failedTemplate:
  20. errorMessage: Name [release-name-common-test-other-workload-name-super-long-name-that-is-longer-than-63-characters] is not valid. Must start and end with an alphanumeric lowercase character. It can contain '-'. And must be at most 63 characters.
  21. - it: should fail with name starting with underscore
  22. set:
  23. workload:
  24. workload-name:
  25. enabled: true
  26. primary: true
  27. type: Deployment
  28. podSpec: {}
  29. _other-workload-name:
  30. enabled: true
  31. primary: false
  32. type: Deployment
  33. podSpec: {}
  34. asserts:
  35. - failedTemplate:
  36. errorMessage: Name [release-name-common-test-_other-workload-name] is not valid. Must start and end with an alphanumeric lowercase character. It can contain '-'. And must be at most 63 characters.
  37. - it: should fail with invalid type
  38. set:
  39. workload:
  40. workload-name:
  41. enabled: true
  42. primary: true
  43. type: not-valid-type
  44. podSpec: {}
  45. asserts:
  46. - failedTemplate:
  47. errorMessage: Workload - Expected <type> to be one of [Deployment, Job, CronJob], but got [not-valid-type]
  48. - it: should fail without podSpec
  49. set:
  50. workload:
  51. workload-name:
  52. enabled: true
  53. primary: true
  54. type: Deployment
  55. asserts:
  56. - failedTemplate:
  57. errorMessage: Workload - Expected <podSpec> key to exist
  58. - it: should fail without primary enabled workload
  59. set:
  60. workload:
  61. workload-name:
  62. enabled: false
  63. primary: true
  64. type: Deployment
  65. podSpec: {}
  66. other-workload-name:
  67. enabled: true
  68. primary: false
  69. type: Deployment
  70. podSpec: {}
  71. asserts:
  72. - failedTemplate:
  73. errorMessage: Workload - One enabled workload must be primary
  74. - it: should fail more than one primary enabled workload
  75. set:
  76. workload:
  77. workload-name:
  78. enabled: true
  79. primary: true
  80. type: Deployment
  81. podSpec: {}
  82. other-workload-name:
  83. enabled: true
  84. primary: true
  85. type: Deployment
  86. podSpec: {}
  87. asserts:
  88. - failedTemplate:
  89. errorMessage: Workload - Only one workload can be primary
  90. - it: should fail with labels not a dict
  91. set:
  92. workload:
  93. workload-name:
  94. enabled: true
  95. primary: true
  96. type: Deployment
  97. labels: "not a dict"
  98. podSpec: {}
  99. asserts:
  100. - failedTemplate:
  101. errorMessage: Workload - Expected <labels> to be a dictionary, but got [string]
  102. - it: should fail with annotations not a dict
  103. set:
  104. workload:
  105. workload-name:
  106. enabled: true
  107. primary: true
  108. type: Deployment
  109. annotations: "not a dict"
  110. podSpec: {}
  111. asserts:
  112. - failedTemplate:
  113. errorMessage: Workload - Expected <annotations> to be a dictionary, but got [string]