diff --git a/client/hack/README.md b/client/hack/README.md index 489d59190..bc227c656 100644 --- a/client/hack/README.md +++ b/client/hack/README.md @@ -1,8 +1,10 @@ # Scripts User Guide This README documents: + * What update-crd.sh and update-generated-code.sh do * When and how to use them +* The CRD CEL rules test suite ## update-generated-code.sh @@ -104,3 +106,35 @@ Update the restoreSize property to use type string only: ``` * Add the VolumeSnapshot namespace to the `additionalPrinterColumns` section in `client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml`. Refer https://github.com/kubernetes-csi/external-snapshotter/pull/535 for more details. + +## Test suite + +The `test-suite` directory contains several test cases that are useful to +validate if the CEL rules that are included in the CRD definitions +are correctly working. + +### Prerequisites + +- Kubectl access to a cluster with the installed CRDs +- Kubernetes >= 1.30 + +### How to use it + +``` + ./hack/run-cel-tests.sh + + cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.post.yaml: SUCCESS + cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.post.yaml: SUCCESS + cel-tests/volumegroupsnapshotcontent/vgsc-source-empty.yaml: SUCCEES (expected failure) + cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.pre.yaml: SUCCESS + cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-name.yaml: SUCCEES (expected failure) + [...] + cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.pre.yaml -> cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.post.yaml: SUCCEES (expected failure) + cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.pre.yaml -> cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.post.yaml: SUCCEES (expected failure) + cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.pre.yaml -> cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.post.yaml: SUCCEES (expected failure) + cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.pre.yaml -> cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.post.yaml: SUCCEES (expected failure) + [...] + + SUCCESS: 90 + FAILURES: 0 +``` diff --git a/client/hack/cel-tests/.gitignore b/client/hack/cel-tests/.gitignore new file mode 100644 index 000000000..f47cb2045 --- /dev/null +++ b/client/hack/cel-tests/.gitignore @@ -0,0 +1 @@ +*.out diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-class-empty-string.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-class-empty-string.yaml new file mode 100644 index 000000000..dcbbcc51f --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-class-empty-string.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + selector: + matchLabels: + app.kubernetes.io/name: postgresql + volumeGroupSnapshotClassName: "" diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-class-empty-string.yaml.err b/client/hack/cel-tests/volumegroupsnapshot/vgs-class-empty-string.yaml.err new file mode 100644 index 000000000..608f03c81 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-class-empty-string.yaml.err @@ -0,0 +1 @@ +volumeGroupSnapshotClassName must not be the empty string when set diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-content-immutable.post.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-immutable.post.yaml new file mode 100644 index 000000000..41ae422cc --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-immutable.post.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + volumeGroupSnapshotContentName: this-test-changed + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-content-immutable.post.yaml.tx_err b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-immutable.post.yaml.tx_err new file mode 100644 index 000000000..edbb681ab --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-immutable.post.yaml.tx_err @@ -0,0 +1 @@ +volumeGroupSnapshotContentName is immutable diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-content-immutable.pre.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-immutable.pre.yaml new file mode 100644 index 000000000..396d765b2 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-immutable.pre.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + volumeGroupSnapshotContentName: this-test + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-content-to-selector.post.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-to-selector.post.yaml new file mode 100644 index 000000000..61f3de05c --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-to-selector.post.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + selector: + matchLabels: + app.kubernetes.io/name: postgresql + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-content-to-selector.post.yaml.tx_err b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-to-selector.post.yaml.tx_err new file mode 100644 index 000000000..79f7f9233 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-to-selector.post.yaml.tx_err @@ -0,0 +1 @@ +volumeGroupSnapshotContentName is required once set diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-content-to-selector.pre.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-to-selector.pre.yaml new file mode 100644 index 000000000..396d765b2 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-content-to-selector.pre.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + volumeGroupSnapshotContentName: this-test + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-no-class.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-no-class.yaml new file mode 100644 index 000000000..058e3eca5 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-no-class.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + selector: + matchLabels: + app.kubernetes.io/name: postgresql diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-immutable.post.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-immutable.post.yaml new file mode 100644 index 000000000..e2ae3a0e9 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-immutable.post.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + selector: + matchLabels: + app.kubernetes.io/name: mysql + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-immutable.post.yaml.tx_err b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-immutable.post.yaml.tx_err new file mode 100644 index 000000000..843d23388 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-immutable.post.yaml.tx_err @@ -0,0 +1 @@ +selector is immutable diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-immutable.pre.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-immutable.pre.yaml new file mode 100644 index 000000000..61f3de05c --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-immutable.pre.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + selector: + matchLabels: + app.kubernetes.io/name: postgresql + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-to-content.post.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-to-content.post.yaml new file mode 100644 index 000000000..396d765b2 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-to-content.post.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + volumeGroupSnapshotContentName: this-test + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-to-content.post.yaml.tx_err b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-to-content.post.yaml.tx_err new file mode 100644 index 000000000..8a1433b25 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-to-content.post.yaml.tx_err @@ -0,0 +1 @@ +selector is required once set diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-to-content.pre.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-to-content.pre.yaml new file mode 100644 index 000000000..61f3de05c --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-selector-to-content.pre.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + selector: + matchLabels: + app.kubernetes.io/name: postgresql + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-with-content.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-content.yaml new file mode 100644 index 000000000..396d765b2 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-content.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + volumeGroupSnapshotContentName: this-test + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-with-no-selector-no-content.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-no-selector-no-content.yaml new file mode 100644 index 000000000..dc1dd43f4 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-no-selector-no-content.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: {} + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-with-no-selector-no-content.yaml.err b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-no-selector-no-content.yaml.err new file mode 100644 index 000000000..b180ea819 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-no-selector-no-content.yaml.err @@ -0,0 +1 @@ +exactly one of selector and volumeGroupSnapshotContentName must be set diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-with-selector-and-content.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-selector-and-content.yaml new file mode 100644 index 000000000..9f8071bc9 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-selector-and-content.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + selector: + matchLabels: + app.kubernetes.io/name: postgresql + volumeGroupSnapshotContentName: this-test + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-with-selector-and-content.yaml.err b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-selector-and-content.yaml.err new file mode 100644 index 000000000..b180ea819 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-selector-and-content.yaml.err @@ -0,0 +1 @@ +exactly one of selector and volumeGroupSnapshotContentName must be set diff --git a/client/hack/cel-tests/volumegroupsnapshot/vgs-with-selector.yaml b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-selector.yaml new file mode 100644 index 000000000..61f3de05c --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshot/vgs-with-selector.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshot +metadata: + name: new-groupsnapshot-demo +spec: + source: + selector: + matchLabels: + app.kubernetes.io/name: postgresql + volumeGroupSnapshotClassName: csi-hostpath-groupsnapclass diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-name.post.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-name.post.yaml new file mode 100644 index 000000000..2a693aadd --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-name.post.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo-changed + namespace: default + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-name.post.yaml.tx_err b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-name.post.yaml.tx_err new file mode 100644 index 000000000..fc10adb44 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-name.post.yaml.tx_err @@ -0,0 +1 @@ +volumeGroupSnapshotRef is immutable diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-name.pre.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-name.pre.yaml new file mode 100644 index 000000000..00fd3f2e9 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-name.pre.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.post.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.post.yaml new file mode 100644 index 000000000..31d2a2f1b --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.post.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default-changed + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.post.yaml.tx_err b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.post.yaml.tx_err new file mode 100644 index 000000000..fc10adb44 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.post.yaml.tx_err @@ -0,0 +1 @@ +volumeGroupSnapshotRef is immutable diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.pre.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.pre.yaml new file mode 100644 index 000000000..00fd3f2e9 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-change-ref-namespace.pre.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ok.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ok.yaml new file mode 100644 index 000000000..00fd3f2e9 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ok.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-name.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-name.yaml new file mode 100644 index 000000000..8720f5e55 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-name.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-name.yaml.err b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-name.yaml.err new file mode 100644 index 000000000..e45f798ec --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-name.yaml.err @@ -0,0 +1 @@ +both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-namespace.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-namespace.yaml new file mode 100644 index 000000000..b50849738 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-namespace.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + namespace: default + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-namespace.yaml.err b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-namespace.yaml.err new file mode 100644 index 000000000..e45f798ec --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-ref-only-namespace.yaml.err @@ -0,0 +1 @@ +both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-both-volume-and-groupsnapshot.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-both-volume-and-groupsnapshot.yaml new file mode 100644 index 000000000..efd0a0aca --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-both-volume-and-groupsnapshot.yaml @@ -0,0 +1,19 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + groupSnapshotHandles: + volumeGroupSnapshotHandle: this-handle + volumeSnapshotHandles: + - handle + - another-handle + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-both-volume-and-groupsnapshot.yaml.err b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-both-volume-and-groupsnapshot.yaml.err new file mode 100644 index 000000000..f42634826 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-both-volume-and-groupsnapshot.yaml.err @@ -0,0 +1 @@ +exactly one of volumeHandles and groupSnapshotHandles must be set diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-empty.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-empty.yaml new file mode 100644 index 000000000..768bd82f8 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-empty.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: {} + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-empty.yaml.err b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-empty.yaml.err new file mode 100644 index 000000000..f42634826 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-empty.yaml.err @@ -0,0 +1 @@ +exactly one of volumeHandles and groupSnapshotHandles must be set diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.post.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.post.yaml new file mode 100644 index 000000000..066092c2f --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.post.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + groupSnapshotHandles: + volumeGroupSnapshotHandle: this-handle + volumeSnapshotHandles: + - handle + - another-handle + - changed-handle + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.post.yaml.tx_err b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.post.yaml.tx_err new file mode 100644 index 000000000..2550d55e1 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.post.yaml.tx_err @@ -0,0 +1 @@ +groupSnapshotHandles is immutable diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.pre.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.pre.yaml new file mode 100644 index 000000000..5dc5b48fb --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-immutable.pre.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + groupSnapshotHandles: + volumeGroupSnapshotHandle: this-handle + volumeSnapshotHandles: + - handle + - another-handle + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-to-volume.post.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-to-volume.post.yaml new file mode 100644 index 000000000..00fd3f2e9 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-to-volume.post.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-to-volume.post.yaml.tx_err b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-to-volume.post.yaml.tx_err new file mode 100644 index 000000000..61dd13563 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-to-volume.post.yaml.tx_err @@ -0,0 +1 @@ +groupSnapshotHandles is required once set diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-to-volume.pre.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-to-volume.pre.yaml new file mode 100644 index 000000000..5dc5b48fb --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-groupsnapshot-to-volume.pre.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + groupSnapshotHandles: + volumeGroupSnapshotHandle: this-handle + volumeSnapshotHandles: + - handle + - another-handle + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.post.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.post.yaml new file mode 100644 index 000000000..4c642a5b0 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.post.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + - changed + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.post.yaml.tx_err b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.post.yaml.tx_err new file mode 100644 index 000000000..8d68011a3 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.post.yaml.tx_err @@ -0,0 +1 @@ +volumeHandles is immutable diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.pre.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.pre.yaml new file mode 100644 index 000000000..00fd3f2e9 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-immutable.pre.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.post.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.post.yaml new file mode 100644 index 000000000..5dc5b48fb --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.post.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + groupSnapshotHandles: + volumeGroupSnapshotHandle: this-handle + volumeSnapshotHandles: + - handle + - another-handle + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.post.yaml.tx_err b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.post.yaml.tx_err new file mode 100644 index 000000000..87de2958c --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.post.yaml.tx_err @@ -0,0 +1 @@ +volumeHandles is required once set diff --git a/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.pre.yaml b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.pre.yaml new file mode 100644 index 000000000..00fd3f2e9 --- /dev/null +++ b/client/hack/cel-tests/volumegroupsnapshotcontent/vgsc-source-volume-to-groupsnapshot.pre.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 +kind: VolumeGroupSnapshotContent +metadata: + name: new-groupsnapshotcontent-demo +spec: + volumeGroupSnapshotRef: + name: new-groupsnapshot-demo + namespace: default + driver: hostpath.csi.k8s.io + source: + volumeHandles: + - handles + deletionPolicy: Retain diff --git a/client/hack/cel-tests/volumesnapshot/vs-empty-class.yaml b/client/hack/cel-tests/volumesnapshot/vs-empty-class.yaml new file mode 100644 index 000000000..260bd1bcd --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-empty-class.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "" + source: + persistentVolumeClaimName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-empty-class.yaml.err b/client/hack/cel-tests/volumesnapshot/vs-empty-class.yaml.err new file mode 100644 index 000000000..c7b6e8c4b --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-empty-class.yaml.err @@ -0,0 +1 @@ +volumeSnapshotClassName must not be the empty string when set diff --git a/client/hack/cel-tests/volumesnapshot/vs-no-class.yaml b/client/hack/cel-tests/volumesnapshot/vs-no-class.yaml new file mode 100644 index 000000000..e2ac5c7ca --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-no-class.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + source: + persistentVolumeClaimName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-not-empty-class.yaml b/client/hack/cel-tests/volumesnapshot/vs-not-empty-class.yaml new file mode 100644 index 000000000..b5ee761a7 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-not-empty-class.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "class-name" + source: + persistentVolumeClaimName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-empty.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-empty.yaml new file mode 100644 index 000000000..563cc57f7 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-empty.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: {} diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-empty.yaml.err b/client/hack/cel-tests/volumesnapshot/vs-source-empty.yaml.err new file mode 100644 index 000000000..a23460132 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-empty.yaml.err @@ -0,0 +1 @@ +exactly one of volumeSnapshotContentName and persistentVolumeClaimName must be set diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-multiple.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-multiple.yaml new file mode 100644 index 000000000..ae25496d1 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-multiple.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + persistentVolumeClaimName: cluster-example-1 + volumeSnapshotContentName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-multiple.yaml.err b/client/hack/cel-tests/volumesnapshot/vs-source-multiple.yaml.err new file mode 100644 index 000000000..a23460132 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-multiple.yaml.err @@ -0,0 +1 @@ +exactly one of volumeSnapshotContentName and persistentVolumeClaimName must be set diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc-annotate.post.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc-annotate.post.yaml new file mode 100644 index 000000000..7cc189b15 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc-annotate.post.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test + annotations: + p: q +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + persistentVolumeClaimName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc-annotate.pre.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc-annotate.pre.yaml new file mode 100644 index 000000000..e32ddde05 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc-annotate.pre.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + persistentVolumeClaimName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc.post.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc.post.yaml new file mode 100644 index 000000000..0252ee356 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc.post.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + persistentVolumeClaimName: cluster-example-1-p diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc.post.yaml.tx_err b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc.post.yaml.tx_err new file mode 100644 index 000000000..917b7ce3d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc.post.yaml.tx_err @@ -0,0 +1 @@ +persistentVolumeClaimName is immutable diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc.pre.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc.pre.yaml new file mode 100644 index 000000000..e32ddde05 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-pvc.pre.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + persistentVolumeClaimName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-vsc.post.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-vsc.post.yaml new file mode 100644 index 000000000..559d4fe2d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-vsc.post.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + volumeSnapshotContentName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-vsc.post.yaml.tx_err b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-vsc.post.yaml.tx_err new file mode 100644 index 000000000..2f9e88fed --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-vsc.post.yaml.tx_err @@ -0,0 +1 @@ +persistentVolumeClaimName is required once set diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-vsc.pre.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-vsc.pre.yaml new file mode 100644 index 000000000..e32ddde05 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-pvc-to-vsc.pre.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + persistentVolumeClaimName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-pvc.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-pvc.yaml new file mode 100644 index 000000000..e32ddde05 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-pvc.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + persistentVolumeClaimName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-pvc.post.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-pvc.post.yaml new file mode 100644 index 000000000..e32ddde05 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-pvc.post.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + persistentVolumeClaimName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-pvc.post.yaml.tx_err b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-pvc.post.yaml.tx_err new file mode 100644 index 000000000..46b722412 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-pvc.post.yaml.tx_err @@ -0,0 +1 @@ +volumeSnapshotContentName is required once set diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-pvc.pre.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-pvc.pre.yaml new file mode 100644 index 000000000..559d4fe2d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-pvc.pre.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + volumeSnapshotContentName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc-annotate.post.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc-annotate.post.yaml new file mode 100644 index 000000000..69e14d145 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc-annotate.post.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test + annotations: + p: q +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + volumeSnapshotContentName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc-annotate.pre.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc-annotate.pre.yaml new file mode 100644 index 000000000..559d4fe2d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc-annotate.pre.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + volumeSnapshotContentName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc.post.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc.post.yaml new file mode 100644 index 000000000..a2e10a331 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc.post.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + volumeSnapshotContentName: cluster-example-1-p diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc.post.yaml.tx_err b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc.post.yaml.tx_err new file mode 100644 index 000000000..c0bd7ecf4 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc.post.yaml.tx_err @@ -0,0 +1 @@ +Invalid value: "string": volumeSnapshotContentName is immutable diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc.pre.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc.pre.yaml new file mode 100644 index 000000000..559d4fe2d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-vsc-to-vsc.pre.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + volumeSnapshotContentName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshot/vs-source-vscontent.yaml b/client/hack/cel-tests/volumesnapshot/vs-source-vscontent.yaml new file mode 100644 index 000000000..559d4fe2d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshot/vs-source-vscontent.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshot +metadata: + name: new-snapshot-test +spec: + volumeSnapshotClassName: "this-is-a-test" + source: + volumeSnapshotContentName: cluster-example-1 diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-empty-source.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-empty-source.yaml new file mode 100644 index 000000000..6c03c5316 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-empty-source.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: {} + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-empty-source.yaml.err b/client/hack/cel-tests/volumesnapshotcontent/vsc-empty-source.yaml.err new file mode 100644 index 000000000..4d49be438 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-empty-source.yaml.err @@ -0,0 +1 @@ +exactly one of volumeHandle and snapshotHandle must be set diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-multiple-source.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-multiple-source.yaml new file mode 100644 index 000000000..385552cf0 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-multiple-source.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle + snapshotHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-multiple-source.yaml.err b/client/hack/cel-tests/volumesnapshotcontent/vsc-multiple-source.yaml.err new file mode 100644 index 000000000..4d49be438 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-multiple-source.yaml.err @@ -0,0 +1 @@ +exactly one of volumeHandle and snapshotHandle must be set diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-ok-with-snapshothandle.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-ok-with-snapshothandle.yaml new file mode 100644 index 000000000..8a3abe823 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-ok-with-snapshothandle.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + snapshotHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-ok.post.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-ok.post.yaml new file mode 100644 index 000000000..3e9e57b7d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-ok.post.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test + annotations: + test: toast +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-ok.pre.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-ok.pre.yaml new file mode 100644 index 000000000..2f2d78afe --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-ok.pre.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-ok.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-ok.yaml new file mode 100644 index 000000000..2f2d78afe --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-ok.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-name.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-name.yaml new file mode 100644 index 000000000..7fbb9a698 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-name.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle + volumeSnapshotRef: + namespace: test-vs-ns diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-name.yaml.err b/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-name.yaml.err new file mode 100644 index 000000000..55c71126d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-name.yaml.err @@ -0,0 +1 @@ +both spec.volumeSnapshotRef.name and spec.volumeSnapshotRef.namespace must be set diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-namespace.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-namespace.yaml new file mode 100644 index 000000000..7b89f3aeb --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-namespace.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle + volumeSnapshotRef: + name: test diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-namespace.yaml.err b/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-namespace.yaml.err new file mode 100644 index 000000000..55c71126d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-source-no-namespace.yaml.err @@ -0,0 +1 @@ +both spec.volumeSnapshotRef.name and spec.volumeSnapshotRef.namespace must be set diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-immutable.post.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-immutable.post.yaml new file mode 100644 index 000000000..53e65c008 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-immutable.post.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + snapshotHandle: this-handle-changed + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns + sourceVolumeMode: Block diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-immutable.post.yaml.tx_err b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-immutable.post.yaml.tx_err new file mode 100644 index 000000000..47e1eb2da --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-immutable.post.yaml.tx_err @@ -0,0 +1 @@ +snapshotHandle is immutable diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-immutable.pre.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-immutable.pre.yaml new file mode 100644 index 000000000..d0e4c4097 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-immutable.pre.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + snapshotHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns + sourceVolumeMode: Block diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-to-volumehandle.post.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-to-volumehandle.post.yaml new file mode 100644 index 000000000..4e01f9bbf --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-to-volumehandle.post.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-volume-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns + sourceVolumeMode: Block diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-to-volumehandle.post.yaml.tx_err b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-to-volumehandle.post.yaml.tx_err new file mode 100644 index 000000000..5f939ce7d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-to-volumehandle.post.yaml.tx_err @@ -0,0 +1 @@ +snapshotHandle is required once set diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-to-volumehandle.pre.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-to-volumehandle.pre.yaml new file mode 100644 index 000000000..d0e4c4097 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcesnapshothandle-to-volumehandle.pre.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + snapshotHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns + sourceVolumeMode: Block diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-immutable.post.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-immutable.post.yaml new file mode 100644 index 000000000..34c73bf7e --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-immutable.post.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle-changed + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns + sourceVolumeMode: Block diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-immutable.post.yaml.tx_err b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-immutable.post.yaml.tx_err new file mode 100644 index 000000000..054391576 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-immutable.post.yaml.tx_err @@ -0,0 +1 @@ +volumeHandle is immutable diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-immutable.pre.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-immutable.pre.yaml new file mode 100644 index 000000000..39d56bda5 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-immutable.pre.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns + sourceVolumeMode: Block diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-to-snapshothandle.post.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-to-snapshothandle.post.yaml new file mode 100644 index 000000000..614b45284 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-to-snapshothandle.post.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + snapshotHandle: this-snapshot-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns + sourceVolumeMode: Block diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-to-snapshothandle.post.yaml.tx_err b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-to-snapshothandle.post.yaml.tx_err new file mode 100644 index 000000000..00773aa86 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-to-snapshothandle.post.yaml.tx_err @@ -0,0 +1 @@ +volumeHandle is required once set diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-to-snapshothandle.pre.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-to-snapshothandle.pre.yaml new file mode 100644 index 000000000..39d56bda5 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumehandle-to-snapshothandle.pre.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns + sourceVolumeMode: Block diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumemode.post.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumemode.post.yaml new file mode 100644 index 000000000..2f2d78afe --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumemode.post.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumemode.post.yaml.tx_err b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumemode.post.yaml.tx_err new file mode 100644 index 000000000..597457a9d --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumemode.post.yaml.tx_err @@ -0,0 +1 @@ +sourceVolumeMode is required once set diff --git a/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumemode.pre.yaml b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumemode.pre.yaml new file mode 100644 index 000000000..39d56bda5 --- /dev/null +++ b/client/hack/cel-tests/volumesnapshotcontent/vsc-sourcevolumemode.pre.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotContent +metadata: + name: new-snapshotcontent-test +spec: + deletionPolicy: Retain + driver: hostpath.csi.k8s.io + source: + volumeHandle: this-handle + volumeSnapshotRef: + name: test-vs + namespace: test-vs-ns + sourceVolumeMode: Block diff --git a/client/hack/run-cel-tests.sh b/client/hack/run-cel-tests.sh new file mode 100755 index 000000000..80511481a --- /dev/null +++ b/client/hack/run-cel-tests.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +set -eu + +failures=0 +successes=0 + +cd "$(dirname "$0")" + +exec_case() { + local test_case="$1" + local test_case_err="$1.err" + local test_case_out="$1.out" + local ret + local output + local err + + ret=0 + kubectl apply --dry-run=server -f "$test_case" > "$test_case_out" 2>&1 || ret=$? + output=$(cat "$test_case_out") + + if [ $ret == 1 ] && [ ! -f "${test_case_err}" ]; then + echo "${test_case}: FAIL $output" + ((++failures)) + elif [ $ret == 1 ] && [ -f "$test_case_err" ]; then + err=$(cat "$test_case_err") + if grep "$err" "$test_case_out" > /dev/null 2>&1; then + ((++successes)) + echo "$test_case: SUCCEES (expected failure)" + else + echo "$test_case: FAIL (unexpected msg): $output" + ((++failures)) + fi + elif [ $ret == 0 ] && [ -f "$test_case_err" ]; then + echo "$test_case: FAIL (unexpected success): $output" + ((++failures)) + elif [ $ret == 0 ] && [ ! -f "$test_case_err" ]; then + echo "$test_case: SUCCESS" + ((++successes)) + fi +} + +exec_tx_case() { + local test_case_pre="$1" + local test_case_post="${1/pre/post}" + local test_case_out="${1/pre.yaml/post.yaml.out}" + local test_case_err="${1/pre.yaml/post.yaml.tx_err}" + local ret=0 + local output + + if ! kubectl apply -f "$test_case_pre" > /dev/null 2>&1; then + echo "$test_case_pre: FAIL applying" + ((++failures)) + return + fi + kubectl apply -f "$test_case_post" > "$test_case_out" 2>&1 || ret=$? + kubectl delete -f "$test_case_post" > /dev/null 2>&1 + output=$(cat "$test_case_out") + + local test_header="${test_case_pre} -> ${test_case_post}:" + + if [ $ret == 1 ] && [ ! -f "${test_case_err}" ]; then + echo "$test_header FAIL $output" + ((++failures)) + elif [ $ret == 1 ] && [ -f "$test_case_err" ]; then + local err + err=$(cat "$test_case_err") + if grep "$err" "$test_case_out" > /dev/null 2>&1; then + echo "$test_header SUCCEES (expected failure)" + ((++successes)) + else + echo "$test_header FAIL (unexpected msg): $output" + ((++failures)) + fi + elif [ $ret == 0 ] && [ -f "$test_case_err" ]; then + echo "$test_header FAIL (unexpected success): $output" + ((++failures)) + elif [ $ret == 0 ] && [ ! -f "$test_case_err" ]; then + echo "$test_header SUCCESS" + ((++successes)) + fi +} + +while IFS= read -r test_case; do + exec_case "$test_case" +done < <(find cel-tests -name \*.yaml) + +while IFS= read -r test_case; do + exec_tx_case "$test_case" +done < <(find cel-tests -name \*.pre.yaml) + +echo +echo "SUCCESS: ${successes}" +echo "FAILURES: ${failures}" + +if [ "${failures}" != 0 ]; then + exit 1 +fi