validation_test.yaml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. suite: persistence validation test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should fail with annotations not a dict
  6. set:
  7. persistence:
  8. volume1:
  9. enabled: true
  10. annotations: not-a-dict
  11. asserts:
  12. - failedTemplate:
  13. errorMessage: Persistence - Expected <annotations> to be a dictionary, but got [string]
  14. - it: should fail with labels not a dict
  15. set:
  16. persistence:
  17. volume1:
  18. enabled: true
  19. labels: not-a-dict
  20. asserts:
  21. - failedTemplate:
  22. errorMessage: Persistence - Expected <labels> to be a dictionary, but got [string]
  23. - it: should fail with pod targetSelector not a map
  24. set:
  25. workload:
  26. main:
  27. enabled: true
  28. primary: true
  29. type: Deployment
  30. podSpec: {}
  31. persistence:
  32. volume1:
  33. enabled: true
  34. targetSelector: not-a-map
  35. asserts:
  36. - failedTemplate:
  37. errorMessage: Persistence - Expected <targetSelector> to be [dict], but got [string]
  38. - it: should fail with invalid type
  39. set:
  40. workload:
  41. main:
  42. enabled: true
  43. primary: true
  44. type: Deployment
  45. podSpec: {}
  46. persistence:
  47. volume1:
  48. enabled: true
  49. type: not-a-type
  50. asserts:
  51. - failedTemplate:
  52. errorMessage: Persistence - Expected <type> to be one of [smb-pv-pvc, nfs-pv-pvc, ix-zfs-pvc, pvc, emptyDir, hostPath, ixVolume, secret, configmap, device], but got [not-a-type]
  53. - it: should fail with invalid accessMode
  54. set:
  55. persistence:
  56. volume1:
  57. enabled: true
  58. type: ix-zfs-pvc
  59. accessModes:
  60. - not-an-access-mode
  61. asserts:
  62. - failedTemplate:
  63. errorMessage: Persistent Volume Claim - Expected <accessModes> entry to be one of [ReadWriteOnce, ReadOnlyMany, ReadWriteMany, ReadWriteOncePod], but got [not-an-access-mode]
  64. - it: should fail without storageClassName in ixChartContext
  65. set:
  66. global:
  67. ixChartContext:
  68. storageClassName: ""
  69. persistence:
  70. volume1:
  71. enabled: true
  72. type: ix-zfs-pvc
  73. asserts:
  74. - failedTemplate:
  75. errorMessage: Persistent Volume Claim - Expected non-empty <global.ixChartContext.storageClassName> on [ix-zfs-pvc] type
  76. - it: should fail with non-existent configmap
  77. set:
  78. configmap:
  79. my-configmap:
  80. enabled: true
  81. data:
  82. foo: bar
  83. persistence:
  84. volume1:
  85. enabled: true
  86. type: configmap
  87. mountPath: /mnt/volume1
  88. objectName: my-non-existent-configmap
  89. image: &image
  90. repository: nginx
  91. tag: 1.17.6
  92. pullPolicy: IfNotPresent
  93. workload: &workload
  94. main:
  95. enabled: true
  96. primary: true
  97. type: Deployment
  98. podSpec:
  99. containers:
  100. main:
  101. enabled: true
  102. primary: true
  103. probes:
  104. liveness:
  105. enabled: false
  106. readiness:
  107. enabled: false
  108. startup:
  109. enabled: false
  110. asserts:
  111. - failedTemplate:
  112. errorMessage: Persistence - Expected configmap [my-non-existent-configmap] defined in <objectName> to exist
  113. - it: should fail with non-existent secret
  114. set:
  115. secret:
  116. my-secret:
  117. enabled: true
  118. data:
  119. foo: bar
  120. persistence:
  121. volume1:
  122. enabled: true
  123. type: secret
  124. mountPath: /mnt/volume1
  125. objectName: my-non-existent-secret
  126. image: *image
  127. workload: *workload
  128. asserts:
  129. - failedTemplate:
  130. errorMessage: Persistence - Expected secret [my-non-existent-secret] defined in <objectName> to exist
  131. - it: should fail without server on nfs-pv-pvc
  132. set:
  133. persistence:
  134. volume1:
  135. enabled: true
  136. type: nfs-pv-pvc
  137. asserts:
  138. - failedTemplate:
  139. errorMessage: NFS CSI - Expected <server> to be non-empty
  140. - it: should fail without share on nfs-pv-pvc
  141. set:
  142. persistence:
  143. volume1:
  144. enabled: true
  145. type: nfs-pv-pvc
  146. server: my-server.local
  147. asserts:
  148. - failedTemplate:
  149. errorMessage: NFS CSI - Expected <share> to be non-empty
  150. - it: should fail without server on smb-pv-pvc
  151. set:
  152. persistence:
  153. volume1:
  154. enabled: true
  155. type: smb-pv-pvc
  156. asserts:
  157. - failedTemplate:
  158. errorMessage: SMB CSI - Expected <server> to be non-empty
  159. - it: should fail without share on smb-pv-pvc
  160. set:
  161. persistence:
  162. volume1:
  163. enabled: true
  164. type: smb-pv-pvc
  165. server: my-server.local
  166. asserts:
  167. - failedTemplate:
  168. errorMessage: SMB CSI - Expected <share> to be non-empty
  169. - it: should fail without CSI when in ixChartContext on smb-pv-pvc
  170. set:
  171. global:
  172. ixChartContext: {}
  173. persistence:
  174. volume1:
  175. enabled: true
  176. type: smb-pv-pvc
  177. server: my-server.local
  178. share: share
  179. asserts:
  180. - failedTemplate:
  181. errorMessage: SMB CSI - Not supported CSI
  182. - it: should fail without CSI when in ixChartContext on nfs-pv-pvc
  183. set:
  184. global:
  185. ixChartContext: {}
  186. persistence:
  187. volume1:
  188. enabled: true
  189. type: nfs-pv-pvc
  190. server: my-server.local
  191. share: /share
  192. asserts:
  193. - failedTemplate:
  194. errorMessage: NFS CSI - Not supported CSI
  195. - it: should fail without username smb-pv-pvc
  196. set:
  197. persistence:
  198. volume1:
  199. enabled: true
  200. type: smb-pv-pvc
  201. server: my-server.local
  202. share: share
  203. asserts:
  204. - failedTemplate:
  205. errorMessage: SMB CSI - Expected <username> to be non-empty
  206. - it: should fail without password on smb-pv-pvc
  207. set:
  208. persistence:
  209. volume1:
  210. enabled: true
  211. type: smb-pv-pvc
  212. server: my-server.local
  213. share: share
  214. username: my-user
  215. asserts:
  216. - failedTemplate:
  217. errorMessage: SMB CSI - Expected <password> to be non-empty
  218. - it: should fail with server starting with // on smb-pv-pvc
  219. set:
  220. persistence:
  221. volume1:
  222. enabled: true
  223. type: smb-pv-pvc
  224. server: //my-server.local
  225. share: share
  226. username: my-user
  227. password: my-password
  228. asserts:
  229. - failedTemplate:
  230. errorMessage: SMB CSI - Did not expect <server> to start with [//]
  231. - it: should fail with share starting with / on smb-pv-pvc
  232. set:
  233. persistence:
  234. volume1:
  235. enabled: true
  236. type: smb-pv-pvc
  237. server: my-server.local
  238. share: /share
  239. username: my-user
  240. password: my-password
  241. asserts:
  242. - failedTemplate:
  243. errorMessage: SMB CSI - Did not expect <share> to start with [/]
  244. - it: should fail with share starting with / on nfs-pv-pvc
  245. set:
  246. persistence:
  247. volume1:
  248. enabled: true
  249. type: nfs-pv-pvc
  250. server: my-server.local
  251. share: share
  252. asserts:
  253. - failedTemplate:
  254. errorMessage: NFS CSI - Expected <share> to start with [/]
  255. - it: should fail with empty key on mountOptions in nfs-pv-pvc
  256. set:
  257. persistence:
  258. volume1:
  259. enabled: true
  260. type: nfs-pv-pvc
  261. server: my-server.local
  262. share: /share
  263. mountOptions:
  264. - key: ""
  265. asserts:
  266. - failedTemplate:
  267. errorMessage: NFS CSI - Expected key in <mountOptions> to be non-empty
  268. - it: should fail with empty key on mountOptions in smb-pv-pvc
  269. set:
  270. persistence:
  271. volume1:
  272. enabled: true
  273. type: smb-pv-pvc
  274. server: my-server.local
  275. share: share
  276. username: my-user
  277. password: my-password
  278. mountOptions:
  279. - key: ""
  280. asserts:
  281. - failedTemplate:
  282. errorMessage: SMB CSI - Expected key in <mountOptions> to be non-empty
  283. - it: should fail with item in mountOptions not a map in smb-pv-pvc
  284. set:
  285. persistence:
  286. volume1:
  287. enabled: true
  288. type: smb-pv-pvc
  289. server: my-server.local
  290. share: share
  291. username: my-user
  292. password: my-password
  293. mountOptions:
  294. - not-a-map
  295. asserts:
  296. - failedTemplate:
  297. errorMessage: SMB CSI - Expected <mountOption> item to be a dict, but got [string]
  298. - it: should fail with item in mountOptions not a map in nfs-pv-pvc
  299. set:
  300. persistence:
  301. volume1:
  302. enabled: true
  303. type: nfs-pv-pvc
  304. server: my-server.local
  305. share: /share
  306. mountOptions:
  307. - not-a-map
  308. asserts:
  309. - failedTemplate:
  310. errorMessage: NFS CSI - Expected <mountOption> item to be a dict, but got [string]