validation_test.yaml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. suite: service account validation test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should fail with name longer than 63 characters
  6. set:
  7. serviceAccount:
  8. my-sa:
  9. enabled: true
  10. primary: true
  11. my-service-account-super-long-name-that-is-longer-than-63-characters:
  12. enabled: true
  13. primary: false
  14. asserts:
  15. - failedTemplate:
  16. errorMessage: Name [release-name-common-test-my-service-account-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.
  17. - it: should fail with name starting with underscore
  18. set:
  19. serviceAccount:
  20. my-sa1:
  21. enabled: true
  22. primary: true
  23. _my-sa2:
  24. enabled: true
  25. primary: false
  26. asserts:
  27. - failedTemplate:
  28. errorMessage: Name [release-name-common-test-_my-sa2] is not valid. Must start and end with an alphanumeric lowercase character. It can contain '-'. And must be at most 63 characters.
  29. - it: should fail with labels not a dict
  30. set:
  31. serviceAccount:
  32. my-sa:
  33. enabled: true
  34. primary: true
  35. labels: "not a dict"
  36. asserts:
  37. - failedTemplate:
  38. errorMessage: Service Account - Expected <labels> to be a dictionary, but got [string]
  39. - it: should fail with annotations not a dict
  40. set:
  41. serviceAccount:
  42. my-sa:
  43. enabled: true
  44. primary: true
  45. annotations: "not a dict"
  46. asserts:
  47. - failedTemplate:
  48. errorMessage: Service Account - Expected <annotations> to be a dictionary, but got [string]
  49. - it: should fail with more than 1 primary service accounts
  50. set:
  51. serviceAccount:
  52. my-sa:
  53. enabled: true
  54. primary: true
  55. my-sa2:
  56. enabled: true
  57. primary: true
  58. asserts:
  59. - failedTemplate:
  60. errorMessage: Service Account - Only one service account can be primary
  61. - it: should fail without any primary on enabled service accounts
  62. set:
  63. serviceAccount:
  64. my-sa:
  65. enabled: true
  66. primary: false
  67. my-sa2:
  68. enabled: true
  69. primary: false
  70. asserts:
  71. - failedTemplate:
  72. errorMessage: Service Account - At least one enabled service account must be primary