validation_test.yaml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. suite: secret validation test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should fail with name longer than 63 characters
  6. set:
  7. secret:
  8. my-secret-super-long-name-that-is-longer-than-63-characters:
  9. enabled: true
  10. data:
  11. foo: bar
  12. asserts:
  13. - failedTemplate:
  14. errorMessage: Name [release-name-common-test-my-secret-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.
  15. - it: should fail with name starting with underscore
  16. set:
  17. secret:
  18. _my-secret:
  19. enabled: true
  20. data:
  21. foo: bar
  22. asserts:
  23. - failedTemplate:
  24. errorMessage: Name [release-name-common-test-_my-secret] is not valid. Must start and end with an alphanumeric lowercase character. It can contain '-'. And must be at most 63 characters.
  25. - it: should fail with labels not a dict
  26. set:
  27. secret:
  28. my-secret:
  29. enabled: true
  30. labels: "not a dict"
  31. data:
  32. foo: bar
  33. asserts:
  34. - failedTemplate:
  35. errorMessage: Secret - Expected <labels> to be a dictionary, but got [string]
  36. - it: should fail with annotations not a dict
  37. set:
  38. secret:
  39. my-secret:
  40. enabled: true
  41. annotations: "not a dict"
  42. data:
  43. foo: bar
  44. asserts:
  45. - failedTemplate:
  46. errorMessage: Secret - Expected <annotations> to be a dictionary, but got [string]
  47. - it: should fail with data not a dict
  48. set:
  49. secret:
  50. my-secret:
  51. enabled: true
  52. data: "not a dict"
  53. asserts:
  54. - failedTemplate:
  55. errorMessage: Secret - Expected <data> to be a dictionary, but got [string]
  56. - it: should fail with empty data
  57. set:
  58. secret:
  59. my-secret:
  60. enabled: true
  61. data: {}
  62. asserts:
  63. - failedTemplate:
  64. errorMessage: Secret - Expected non-empty <data>
  65. - it: should fail with empty type key
  66. set:
  67. secret:
  68. my-secret:
  69. enabled: true
  70. type: ""
  71. data:
  72. foo: bar
  73. asserts:
  74. - failedTemplate:
  75. errorMessage: Secret - Found <type> key, but it's empty