volume_hostPath_test.yaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. suite: pod hostPath volume test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should pass with hostPath volume
  6. set:
  7. workload:
  8. workload-name1:
  9. enabled: true
  10. primary: true
  11. type: Deployment
  12. podSpec: {}
  13. persistence:
  14. host-vol:
  15. enabled: true
  16. type: hostPath
  17. hostPath: /some-path
  18. asserts:
  19. - documentIndex: &deploymentDoc 0
  20. isKind:
  21. of: Deployment
  22. - documentIndex: *deploymentDoc
  23. contains:
  24. path: spec.template.spec.volumes
  25. content:
  26. name: host-vol
  27. hostPath:
  28. path: /some-path
  29. - it: should pass with hostPath volume and type
  30. set:
  31. some_path: /some-path
  32. some_type: DirectoryOrCreate
  33. workload:
  34. workload-name1:
  35. enabled: true
  36. primary: true
  37. type: Deployment
  38. podSpec: {}
  39. persistence:
  40. host-vol:
  41. enabled: true
  42. type: hostPath
  43. hostPath: "{{ .Values.some_path }}"
  44. hostPathType: "{{ .Values.some_type }}"
  45. asserts:
  46. - documentIndex: *deploymentDoc
  47. isKind:
  48. of: Deployment
  49. - documentIndex: *deploymentDoc
  50. contains:
  51. path: spec.template.spec.volumes
  52. content:
  53. name: host-vol
  54. hostPath:
  55. path: /some-path
  56. type: DirectoryOrCreate
  57. # Failures
  58. - it: should fail without hostPath
  59. set:
  60. workload:
  61. some-workload:
  62. enabled: true
  63. primary: true
  64. type: Deployment
  65. podSpec: {}
  66. persistence:
  67. volume1:
  68. enabled: true
  69. type: hostPath
  70. hostPath: ""
  71. asserts:
  72. - failedTemplate:
  73. errorMessage: Persistence - Expected non-empty <hostPath> on <hostPath> type
  74. - it: should fail with relative hostPath
  75. set:
  76. workload:
  77. some-workload:
  78. enabled: true
  79. primary: true
  80. type: Deployment
  81. podSpec: {}
  82. persistence:
  83. volume1:
  84. enabled: true
  85. type: hostPath
  86. hostPath: some-path
  87. asserts:
  88. - failedTemplate:
  89. errorMessage: Persistence - Expected <hostPath> to start with a forward slash [/] on <hostPath> type
  90. - it: should fail with invalid hostPathType
  91. set:
  92. workload:
  93. some-workload:
  94. enabled: true
  95. primary: true
  96. type: Deployment
  97. podSpec: {}
  98. persistence:
  99. volume1:
  100. enabled: true
  101. type: hostPath
  102. hostPath: /some-path
  103. hostPathType: invalid
  104. asserts:
  105. - failedTemplate:
  106. errorMessage: Persistence - Expected <hostPathType> to be one of [DirectoryOrCreate, Directory, FileOrCreate, File, Socket, CharDevice, BlockDevice], but got [invalid]