metadata_test.yaml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. suite: rbac metadata test
  2. templates:
  3. - common.yaml
  4. chart:
  5. appVersion: &appVer v9.9.9
  6. tests:
  7. - it: should pass with rbac 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. serviceAccount:
  21. my-sa1:
  22. enabled: true
  23. primary: true
  24. rbac:
  25. my-rbac1:
  26. enabled: true
  27. primary: true
  28. labels:
  29. label1: "{{ .Values.label1 }}"
  30. label2: label2
  31. annotations:
  32. annotation1: "{{ .Values.annotation1 }}"
  33. annotation2: annotation2
  34. rules:
  35. - apiGroups:
  36. - ""
  37. resources:
  38. - pods
  39. verbs:
  40. - get
  41. - list
  42. - watch
  43. my-rbac2:
  44. enabled: true
  45. primary: false
  46. clusterWide: true
  47. allServiceAccounts: true
  48. labels:
  49. label1: "{{ .Values.label1 }}"
  50. label2: label2
  51. annotations:
  52. annotation1: "{{ .Values.annotation1 }}"
  53. annotation2: annotation2
  54. rules:
  55. - apiGroups:
  56. - ""
  57. resources:
  58. - pods
  59. verbs:
  60. - get
  61. - list
  62. - watch
  63. asserts:
  64. - documentIndex: &roleDoc 1
  65. isKind:
  66. of: Role
  67. - documentIndex: *roleDoc
  68. equal:
  69. path: metadata.annotations
  70. value:
  71. annotation1: annotation1
  72. annotation2: annotation2
  73. g_annotation1: global_annotation1
  74. g_annotation2: global_annotation2
  75. - documentIndex: *roleDoc
  76. equal:
  77. path: metadata.labels
  78. value:
  79. app: common-test-1.0.0
  80. release: RELEASE-NAME
  81. helm-revision: "0"
  82. helm.sh/chart: common-test-1.0.0
  83. app.kubernetes.io/managed-by: Helm
  84. app.kubernetes.io/version: *appVer
  85. g_label1: global_label1
  86. g_label2: global_label2
  87. label1: label1
  88. label2: label2
  89. - documentIndex: &roleBindingDoc 2
  90. isKind:
  91. of: RoleBinding
  92. - documentIndex: *roleBindingDoc
  93. equal:
  94. path: metadata.annotations
  95. value:
  96. annotation1: annotation1
  97. annotation2: annotation2
  98. g_annotation1: global_annotation1
  99. g_annotation2: global_annotation2
  100. - documentIndex: *roleBindingDoc
  101. equal:
  102. path: metadata.labels
  103. value:
  104. app: common-test-1.0.0
  105. release: RELEASE-NAME
  106. helm-revision: "0"
  107. helm.sh/chart: common-test-1.0.0
  108. app.kubernetes.io/managed-by: Helm
  109. app.kubernetes.io/version: *appVer
  110. g_label1: global_label1
  111. g_label2: global_label2
  112. label1: label1
  113. label2: label2
  114. - documentIndex: &clusterRoleDoc 3
  115. isKind:
  116. of: ClusterRole
  117. - documentIndex: *clusterRoleDoc
  118. equal:
  119. path: metadata.annotations
  120. value:
  121. annotation1: annotation1
  122. annotation2: annotation2
  123. g_annotation1: global_annotation1
  124. g_annotation2: global_annotation2
  125. - documentIndex: *clusterRoleDoc
  126. equal:
  127. path: metadata.labels
  128. value:
  129. app: common-test-1.0.0
  130. release: RELEASE-NAME
  131. helm-revision: "0"
  132. helm.sh/chart: common-test-1.0.0
  133. app.kubernetes.io/managed-by: Helm
  134. app.kubernetes.io/version: *appVer
  135. g_label1: global_label1
  136. g_label2: global_label2
  137. label1: label1
  138. label2: label2
  139. - documentIndex: &clusterRoleBindingDoc 4
  140. isKind:
  141. of: ClusterRoleBinding
  142. - documentIndex: *clusterRoleBindingDoc
  143. equal:
  144. path: metadata.annotations
  145. value:
  146. annotation1: annotation1
  147. annotation2: annotation2
  148. g_annotation1: global_annotation1
  149. g_annotation2: global_annotation2
  150. - documentIndex: *clusterRoleBindingDoc
  151. equal:
  152. path: metadata.labels
  153. value:
  154. app: common-test-1.0.0
  155. release: RELEASE-NAME
  156. helm-revision: "0"
  157. helm.sh/chart: common-test-1.0.0
  158. app.kubernetes.io/managed-by: Helm
  159. app.kubernetes.io/version: *appVer
  160. g_label1: global_label1
  161. g_label2: global_label2
  162. label1: label1
  163. label2: label2