validation_test.yaml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. suite: persistence validation test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should fail with pod targetSelector not a map
  6. set:
  7. workload:
  8. main:
  9. enabled: true
  10. primary: true
  11. type: Deployment
  12. podSpec: {}
  13. persistence:
  14. volume1:
  15. enabled: true
  16. targetSelector: not-a-map
  17. asserts:
  18. - failedTemplate:
  19. errorMessage: Persistence - Expected <targetSelector> to be [dict], but got [string]
  20. - it: should fail with invalid type
  21. set:
  22. workload:
  23. main:
  24. enabled: true
  25. primary: true
  26. type: Deployment
  27. podSpec: {}
  28. persistence:
  29. volume1:
  30. enabled: true
  31. type: not-a-type
  32. asserts:
  33. - failedTemplate:
  34. errorMessage: Persistence - Expected <type> to be one of [emptyDir, hostPath, ixVolume, secret, configmap, device], but got [not-a-type]
  35. - it: should fail with non-existent configmap
  36. set:
  37. configmap:
  38. my-configmap:
  39. enabled: true
  40. data:
  41. foo: bar
  42. persistence:
  43. volume1:
  44. enabled: true
  45. type: configmap
  46. mountPath: /mnt/volume1
  47. objectName: my-non-existent-configmap
  48. image: &image
  49. repository: nginx
  50. tag: 1.17.6
  51. pullPolicy: IfNotPresent
  52. workload: &workload
  53. main:
  54. enabled: true
  55. primary: true
  56. type: Deployment
  57. podSpec:
  58. containers:
  59. main:
  60. enabled: true
  61. primary: true
  62. probes:
  63. liveness:
  64. enabled: false
  65. readiness:
  66. enabled: false
  67. startup:
  68. enabled: false
  69. asserts:
  70. - failedTemplate:
  71. errorMessage: Persistence - Expected configmap [my-non-existent-configmap] defined in <objectName> to exist
  72. - it: should fail with non-existent secret
  73. set:
  74. secret:
  75. my-secret:
  76. enabled: true
  77. data:
  78. foo: bar
  79. persistence:
  80. volume1:
  81. enabled: true
  82. type: secret
  83. mountPath: /mnt/volume1
  84. objectName: my-non-existent-secret
  85. image: *image
  86. workload: *workload
  87. asserts:
  88. - failedTemplate:
  89. errorMessage: Persistence - Expected secret [my-non-existent-secret] defined in <objectName> to exist