volume_ixVolume_test.yaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. suite: pod ixVolume volume test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should pass with ixVolume volume
  6. set:
  7. workload:
  8. workload-name1:
  9. enabled: true
  10. primary: true
  11. type: Deployment
  12. podSpec: {}
  13. ixVolumes:
  14. - hostPath: /mnt/pool/ix-applications/ix-app
  15. persistence:
  16. ix-vol:
  17. enabled: true
  18. type: ixVolume
  19. datasetName: ix-app
  20. asserts:
  21. - documentIndex: &deploymentDoc 0
  22. isKind:
  23. of: Deployment
  24. - documentIndex: *deploymentDoc
  25. contains:
  26. path: spec.template.spec.volumes
  27. content:
  28. name: ix-vol
  29. hostPath:
  30. path: /mnt/pool/ix-applications/ix-app
  31. - it: should pass with multiple ixVolume volumes
  32. set:
  33. workload:
  34. workload-name1:
  35. enabled: true
  36. primary: true
  37. type: Deployment
  38. podSpec: {}
  39. ixVolumes:
  40. - hostPath: /mnt/pool/ix-applications/ix-app1
  41. - hostPath: /mnt/pool/ix-applications/ix-app2
  42. persistence:
  43. ix-vol1:
  44. enabled: true
  45. type: ixVolume
  46. datasetName: ix-app1
  47. ix-vol2:
  48. enabled: true
  49. type: ixVolume
  50. datasetName: ix-app2
  51. asserts:
  52. - documentIndex: &deploymentDoc 0
  53. isKind:
  54. of: Deployment
  55. - documentIndex: *deploymentDoc
  56. contains:
  57. path: spec.template.spec.volumes
  58. content:
  59. name: ix-vol1
  60. hostPath:
  61. path: /mnt/pool/ix-applications/ix-app1
  62. - documentIndex: *deploymentDoc
  63. contains:
  64. path: spec.template.spec.volumes
  65. content:
  66. name: ix-vol2
  67. hostPath:
  68. path: /mnt/pool/ix-applications/ix-app2
  69. - it: should pass with ixVolume and hostPathType
  70. set:
  71. some_dataset: ix-app
  72. some_type: DirectoryOrCreate
  73. workload:
  74. workload-name1:
  75. enabled: true
  76. primary: true
  77. type: Deployment
  78. podSpec: {}
  79. ixVolumes:
  80. - hostPath: /mnt/pool/ix-applications/ix-app
  81. persistence:
  82. ix-vol:
  83. enabled: true
  84. type: ixVolume
  85. datasetName: "{{ .Values.some_dataset }}"
  86. hostPathType: "{{ .Values.some_type }}"
  87. asserts:
  88. - documentIndex: *deploymentDoc
  89. isKind:
  90. of: Deployment
  91. - documentIndex: *deploymentDoc
  92. contains:
  93. path: spec.template.spec.volumes
  94. content:
  95. name: ix-vol
  96. hostPath:
  97. path: /mnt/pool/ix-applications/ix-app
  98. type: DirectoryOrCreate
  99. # Failures
  100. - it: should fail without datasetName
  101. set:
  102. workload:
  103. some-workload:
  104. enabled: true
  105. primary: true
  106. type: Deployment
  107. podSpec: {}
  108. persistence:
  109. volume1:
  110. enabled: true
  111. type: ixVolume
  112. datasetname: ""
  113. asserts:
  114. - failedTemplate:
  115. errorMessage: Persistence - Expected non-empty <datasetName> on <ixVolume> type
  116. - it: should fail with empty ixVolumes
  117. set:
  118. workload:
  119. some-workload:
  120. enabled: true
  121. primary: true
  122. type: Deployment
  123. podSpec: {}
  124. ixVolumes: []
  125. persistence:
  126. volume1:
  127. enabled: true
  128. type: ixVolume
  129. datasetName: ix-app
  130. asserts:
  131. - failedTemplate:
  132. errorMessage: Persistence - Expected non-empty <ixVolumes> in values on <ixVolume> type
  133. - it: should fail with wrong ixVolumes
  134. set:
  135. workload:
  136. some-workload:
  137. enabled: true
  138. primary: true
  139. type: Deployment
  140. podSpec: {}
  141. ixVolumes:
  142. - hostPath: /mnt/pool/ix-applications/ix-wrong-app
  143. - hostPath: /mnt/pool/ix-applications/ix-other-app
  144. persistence:
  145. volume1:
  146. enabled: true
  147. type: ixVolume
  148. datasetName: ix-app
  149. asserts:
  150. - failedTemplate:
  151. errorMessage: Persistence - Expected <datasetName> [ix-app] to exist on <ixVolumes> list, but list contained [ix-wrong-app, ix-other-app] on <ixVolume> type
  152. - it: should fail with invalid hostPathType
  153. set:
  154. workload:
  155. some-workload:
  156. enabled: true
  157. primary: true
  158. type: Deployment
  159. podSpec: {}
  160. ixVolumes:
  161. - hostPath: /mnt/pool/ix-applications/ix-app
  162. persistence:
  163. volume1:
  164. enabled: true
  165. type: ixVolume
  166. datasetName: ix-app
  167. hostPathType: invalid
  168. asserts:
  169. - failedTemplate:
  170. errorMessage: Persistence - Expected <hostPathType> to be one of [DirectoryOrCreate, Directory, FileOrCreate, File, Socket, CharDevice, BlockDevice], but got [invalid]