Created
November 11, 2022 21:30
-
-
Save pivotaljohn/62ed26b8de51183d2bd55cdbb80207cc to your computer and use it in GitHub Desktop.
Writing assertion without modifying target using an overlay.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:overlay", "overlay") | |
#@overlay/match by=overlay.subset({"kind": "ClusterRole", "metadata":{"name":"my-meow"}}) | |
--- | |
rules: | |
#@overlay/match by=overlay.all | |
- | |
#@overlay/assert via=lambda given,expects: (given[0]==expects[0], "Given '{}', expects '{}'".format(given[0],expects[0])) | |
resourceNames: | |
#@overlay/match by=overlay.all | |
- "meow" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRole | |
metadata: | |
name: my-meow | |
rules: | |
- apiGroups: | |
- cat.meow.io | |
resourceNames: | |
- meow | |
resources: | |
- meowResource | |
verbs: | |
- use |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment