validation_test.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. suite: imagePullSecret validation test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should fail with name longer than 63 characters
  6. set:
  7. imagePullSecret:
  8. my-pull-secret-super-long-name-that-is-longer-than-63-characters:
  9. enabled: true
  10. data: &data
  11. registry: reg
  12. username: user
  13. password: pass
  14. email: mail
  15. asserts:
  16. - failedTemplate:
  17. errorMessage: Name [release-name-common-test-my-pull-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.
  18. - it: should fail with name starting with underscore
  19. set:
  20. imagePullSecret:
  21. _my-pull-secret:
  22. enabled: true
  23. data: *data
  24. asserts:
  25. - failedTemplate:
  26. errorMessage: Name [release-name-common-test-_my-pull-secret] is not valid. Must start and end with an alphanumeric lowercase character. It can contain '-'. And must be at most 63 characters.
  27. - it: should fail with labels not a dict
  28. set:
  29. imagePullSecret:
  30. my-pull-secret:
  31. enabled: true
  32. labels: "not a dict"
  33. data: *data
  34. asserts:
  35. - failedTemplate:
  36. errorMessage: Image Pull Secret - Expected <labels> to be a dictionary, but got [string]
  37. - it: should fail with annotations not a dict
  38. set:
  39. imagePullSecret:
  40. my-pull-secret:
  41. enabled: true
  42. annotations: "not a dict"
  43. data: *data
  44. asserts:
  45. - failedTemplate:
  46. errorMessage: Image Pull Secret - Expected <annotations> to be a dictionary, but got [string]
  47. - it: should fail with data not a dict
  48. set:
  49. imagePullSecret:
  50. my-pull-secret:
  51. enabled: true
  52. data: "not a dict"
  53. asserts:
  54. - failedTemplate:
  55. errorMessage: Image Pull Secret - Expected <data> to be a dictionary, but got [string]
  56. - it: should fail with empty data
  57. set:
  58. imagePullSecret:
  59. my-pull-secret:
  60. enabled: true
  61. data: {}
  62. asserts:
  63. - failedTemplate:
  64. errorMessage: Image Pull Secret - Expected non-empty <data>
  65. - it: should fail with empty registry key
  66. set:
  67. imagePullSecret:
  68. my-pull-secret:
  69. enabled: true
  70. type: ""
  71. data:
  72. registry: ""
  73. username: user
  74. password: pass
  75. email: mail
  76. asserts:
  77. - failedTemplate:
  78. errorMessage: Image Pull Secret - Expected non-empty <registry>
  79. - it: should fail with empty username key
  80. set:
  81. imagePullSecret:
  82. my-pull-secret:
  83. enabled: true
  84. type: ""
  85. data:
  86. registry: registry
  87. username: ""
  88. password: pass
  89. email: mail
  90. asserts:
  91. - failedTemplate:
  92. errorMessage: Image Pull Secret - Expected non-empty <username>
  93. - it: should fail with empty password key
  94. set:
  95. imagePullSecret:
  96. my-pull-secret:
  97. enabled: true
  98. type: ""
  99. data:
  100. registry: registry
  101. username: user
  102. password: ""
  103. email: mail
  104. asserts:
  105. - failedTemplate:
  106. errorMessage: Image Pull Secret - Expected non-empty <password>
  107. - it: should fail with empty email key
  108. set:
  109. imagePullSecret:
  110. my-pull-secret:
  111. enabled: true
  112. type: ""
  113. data:
  114. registry: registry
  115. username: user
  116. password: pass
  117. email: ""
  118. asserts:
  119. - failedTemplate:
  120. errorMessage: Image Pull Secret - Expected non-empty <email>