pvc_metadata_test.yaml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. suite: pvc metadata test
  2. templates:
  3. - common.yaml
  4. chart:
  5. appVersion: &appVer v9.9.9
  6. tests:
  7. - it: should pass with pvc created with labels and annotations
  8. set:
  9. label1: label1
  10. label2: global_label2
  11. annotation1: annotation1
  12. annotation2: global_annotation2
  13. global:
  14. labels:
  15. g_label1: global_label1
  16. g_label2: "{{ .Values.label2 }}"
  17. annotations:
  18. g_annotation1: global_annotation1
  19. g_annotation2: "{{ .Values.annotation2 }}"
  20. persistence:
  21. my-volume1:
  22. enabled: true
  23. labels:
  24. label1: "{{ .Values.label1 }}"
  25. label2: label2
  26. annotations:
  27. annotation1: "{{ .Values.annotation1 }}"
  28. annotation2: annotation2
  29. type: pvc
  30. asserts:
  31. - documentIndex: &pvcDoc 0
  32. isKind:
  33. of: PersistentVolumeClaim
  34. - documentIndex: *pvcDoc
  35. isAPIVersion:
  36. of: v1
  37. - documentIndex: *pvcDoc
  38. equal:
  39. path: metadata.annotations
  40. value:
  41. annotation1: annotation1
  42. annotation2: annotation2
  43. g_annotation1: global_annotation1
  44. g_annotation2: global_annotation2
  45. - documentIndex: *pvcDoc
  46. equal:
  47. path: metadata.labels
  48. value:
  49. app: common-test-1.0.0
  50. release: RELEASE-NAME
  51. helm-revision: "0"
  52. helm.sh/chart: common-test-1.0.0
  53. app.kubernetes.io/instance: RELEASE-NAME
  54. app.kubernetes.io/managed-by: Helm
  55. app.kubernetes.io/version: *appVer
  56. app.kubernetes.io/name: common-test
  57. g_label1: global_label1
  58. g_label2: global_label2
  59. label1: label1
  60. label2: label2
  61. - it: should pass with pvc created with retain set to true
  62. set:
  63. persistence:
  64. my-volume1:
  65. enabled: true
  66. type: pvc
  67. retain: true
  68. asserts:
  69. - documentIndex: *pvcDoc
  70. isKind:
  71. of: PersistentVolumeClaim
  72. - documentIndex: *pvcDoc
  73. equal:
  74. path: metadata.annotations
  75. value:
  76. "helm.sh/resource-policy": keep
  77. - documentIndex: *pvcDoc
  78. equal:
  79. path: metadata.labels
  80. value:
  81. app: common-test-1.0.0
  82. release: RELEASE-NAME
  83. helm-revision: "0"
  84. helm.sh/chart: common-test-1.0.0
  85. app.kubernetes.io/instance: RELEASE-NAME
  86. app.kubernetes.io/managed-by: Helm
  87. app.kubernetes.io/version: *appVer
  88. app.kubernetes.io/name: common-test