validation_test.yaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. suite: configmap validation test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should fail with name longer than 63 characters
  6. set:
  7. configmap:
  8. my-configmap-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-configmap-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. configmap:
  18. _my-configmap:
  19. enabled: true
  20. data:
  21. foo: bar
  22. asserts:
  23. - failedTemplate:
  24. errorMessage: Name [release-name-common-test-_my-configmap] 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. configmap:
  28. my-configmap:
  29. enabled: true
  30. labels: "not a dict"
  31. data:
  32. foo: bar
  33. asserts:
  34. - failedTemplate:
  35. errorMessage: ConfigMap - Expected <labels> to be a dictionary, but got [string]
  36. - it: should fail with annotations not a dict
  37. set:
  38. configmap:
  39. my-configmap:
  40. enabled: true
  41. annotations: "not a dict"
  42. data:
  43. foo: bar
  44. asserts:
  45. - failedTemplate:
  46. errorMessage: ConfigMap - Expected <annotations> to be a dictionary, but got [string]
  47. - it: should fail with data not a dict
  48. set:
  49. configmap:
  50. my-configmap:
  51. enabled: true
  52. data: "not a dict"
  53. asserts:
  54. - failedTemplate:
  55. errorMessage: ConfigMap - Expected <data> to be a dictionary, but got [string]
  56. - it: should fail with empty data
  57. set:
  58. configmap:
  59. my-configmap:
  60. enabled: true
  61. data: {}
  62. asserts:
  63. - failedTemplate:
  64. errorMessage: ConfigMap - Expected non-empty <data>