Skip to content

Commit c35fbd4

Browse files
feat: add cel test (#2049) (#2050)
Signed-off-by: Charles-Edouard Brétéché <[email protected]> Co-authored-by: Charles-Edouard Brétéché <[email protected]>
1 parent 5229eac commit c35fbd4

File tree

4 files changed

+100
-1
lines changed

4 files changed

+100
-1
lines changed

testdata/e2e/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ spec:
1515
template:
1616
metadata:
1717
annotations:
18-
from-config-file: ("hello")
18+
from-config-file: (string("hello"))

testdata/e2e/examples/CATALOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [basic](basic/README.md)
88
- [bindings](bindings/README.md)
99
- [catch](catch/README.md)
10+
- [cel](cel/README.md)
1011
- [command-output](command-output/README.md)
1112
- [delete](delete/README.md)
1213
- [delete](delete/README.md)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Test: `cel`
2+
3+
*No description*
4+
5+
## Bindings
6+
7+
| # | Name | Value |
8+
|:-:|---|---|
9+
| 1 | `a` | 1 |
10+
11+
## Steps
12+
13+
| # | Name | Bindings | Try | Catch | Finally | Cleanup |
14+
|:-:|---|:-:|:-:|:-:|:-:|
15+
| 1 | [step-1](#step-step-1) | 1 | 1 | 0 | 0 | 0 |
16+
| 2 | [step-2](#step-step-2) | 1 | 1 | 0 | 0 | 0 |
17+
18+
### Step: `step-1`
19+
20+
*No description*
21+
22+
#### Bindings
23+
24+
| # | Name | Value |
25+
|:-:|---|---|
26+
| 1 | `b` | 2 |
27+
28+
#### Try
29+
30+
| # | Operation | Bindings | Outputs | Description |
31+
|:-:|---|:-:|:-:|---|
32+
| 1 | `apply` | 1 | 0 | *No description* |
33+
34+
### Step: `step-2`
35+
36+
*No description*
37+
38+
#### Bindings
39+
40+
| # | Name | Value |
41+
|:-:|---|---|
42+
| 1 | `b` | 2 |
43+
44+
#### Try
45+
46+
| # | Operation | Bindings | Outputs | Description |
47+
|:-:|---|:-:|:-:|---|
48+
| 1 | `assert` | 1 | 0 | *No description* |
49+
50+
---
51+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# yaml-language-server: $schema=../../../../.schemas/json/test-chainsaw-v1alpha1.json
2+
apiVersion: chainsaw.kyverno.io/v1alpha1
3+
kind: Test
4+
metadata:
5+
name: cel
6+
spec:
7+
bindings:
8+
- name: a
9+
value: 1
10+
steps:
11+
- bindings:
12+
- name: b
13+
value: 2
14+
try:
15+
- compiler: cel
16+
apply:
17+
template: true
18+
bindings:
19+
- name: c
20+
value: (string(bindings.resolve("a") + bindings.resolve("b")))
21+
resource:
22+
apiVersion: v1
23+
kind: ConfigMap
24+
metadata:
25+
name: quick-start
26+
data:
27+
cel: (cel; bindings.resolve("c"))
28+
jp: (jp; $c)
29+
default: (bindings.resolve("c"))
30+
- bindings:
31+
- name: b
32+
value: 2
33+
try:
34+
- assert:
35+
bindings:
36+
- name: c
37+
compiler: cel
38+
value: (string(bindings.resolve("a") + bindings.resolve("b")))
39+
resource:
40+
apiVersion: v1
41+
kind: ConfigMap
42+
metadata:
43+
name: quick-start
44+
data:
45+
cel: (cel; bindings.resolve("c"))
46+
jp: (jp; $c)
47+
default: ($c)

0 commit comments

Comments
 (0)