name_test.yaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. suite: rbac name test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should generate correct name
  6. set:
  7. serviceAccount:
  8. my-sa:
  9. enabled: true
  10. primary: true
  11. rbac:
  12. my-rbac:
  13. enabled: true
  14. primary: true
  15. rules:
  16. - apiGroups:
  17. - ""
  18. resources:
  19. - pods
  20. verbs:
  21. - get
  22. my-rbac2:
  23. enabled: true
  24. clusterWide: true
  25. allServiceAccounts: true
  26. rules:
  27. - apiGroups:
  28. - ""
  29. resources:
  30. - pods
  31. verbs:
  32. - get
  33. my-rbac3:
  34. enabled: true
  35. allServiceAccounts: true
  36. rules:
  37. - apiGroups:
  38. - ""
  39. resources:
  40. - pods
  41. verbs:
  42. - get
  43. asserts:
  44. - documentIndex: &roleDoc 1
  45. isKind:
  46. of: Role
  47. - documentIndex: *roleDoc
  48. isAPIVersion:
  49. of: rbac.authorization.k8s.io/v1
  50. - documentIndex: *roleDoc
  51. equal:
  52. path: metadata.name
  53. value: release-name-common-test
  54. - documentIndex: &roleBindingDoc 2
  55. isKind:
  56. of: RoleBinding
  57. - documentIndex: *roleBindingDoc
  58. isAPIVersion:
  59. of: rbac.authorization.k8s.io/v1
  60. - documentIndex: *roleBindingDoc
  61. equal:
  62. path: metadata.name
  63. value: release-name-common-test
  64. - documentIndex: &clusterRoleDoc 3
  65. isKind:
  66. of: ClusterRole
  67. - documentIndex: *clusterRoleDoc
  68. isAPIVersion:
  69. of: rbac.authorization.k8s.io/v1
  70. - documentIndex: *clusterRoleDoc
  71. equal:
  72. path: metadata.name
  73. value: release-name-common-test-my-rbac2
  74. - documentIndex: &clusterRoleBindingDoc 4
  75. isKind:
  76. of: ClusterRoleBinding
  77. - documentIndex: *clusterRoleBindingDoc
  78. isAPIVersion:
  79. of: rbac.authorization.k8s.io/v1
  80. - documentIndex: *clusterRoleBindingDoc
  81. equal:
  82. path: metadata.name
  83. value: release-name-common-test-my-rbac2
  84. - documentIndex: &otherRoleDoc 5
  85. isKind:
  86. of: Role
  87. - documentIndex: *otherRoleDoc
  88. isAPIVersion:
  89. of: rbac.authorization.k8s.io/v1
  90. - documentIndex: *otherRoleDoc
  91. equal:
  92. path: metadata.name
  93. value: release-name-common-test-my-rbac3
  94. - documentIndex: &otherRoleBindingDoc 6
  95. isKind:
  96. of: RoleBinding
  97. - documentIndex: *otherRoleBindingDoc
  98. isAPIVersion:
  99. of: rbac.authorization.k8s.io/v1
  100. - documentIndex: *otherRoleBindingDoc
  101. equal:
  102. path: metadata.name
  103. value: release-name-common-test-my-rbac3