Skip to content

Commit

Permalink
Add/update resources for testing expansion under the test directory f…
Browse files Browse the repository at this point in the history
…or gator

verify

Signed-off-by: David-Jaeyoon-Lee <[email protected]>
  • Loading branch information
David-Jaeyoon-Lee committed Nov 4, 2024
1 parent f9e6699 commit d3892b4
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
8 changes: 8 additions & 0 deletions test/gator/verify/allow_expansion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: FooTemplate
metadata:
name: foo-template
spec:
template:
foo: bar

8 changes: 8 additions & 0 deletions test/gator/verify/deny_expansion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: FooTemplate
metadata:
name: foo-template
spec:
template:
foo: qux

15 changes: 15 additions & 0 deletions test/gator/verify/expansion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: expansion.gatekeeper.sh/v1alpha1
kind: ExpansionTemplate
metadata:
name: expand-foo
spec:
applyTo:
- groups: [ "apps" ]
kinds: [ "FooTemplate" ]
versions: [ "v1" ]
templateSource: "spec.template"
generatedGVK:
kind: "FooIsBar"
group: ""
version: "v1"

16 changes: 15 additions & 1 deletion test/gator/verify/suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,18 @@ tests:
- name: foo-not-bar
object: deny.yaml
assertions:
- violations: no
- violations: no
- name: foo-is-bar-expansion
template: template.yaml
constraint: constraint.yaml
expansion: expansion.yaml
cases:
- name: foo-bar
object: allow_expansion.yaml
assertions:
- violations: no
- name: foo-not-bar
object: deny_expansion.yaml
assertions:
- violations: yes

0 comments on commit d3892b4

Please sign in to comment.