-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathe2e.bats
31 lines (25 loc) · 977 Bytes
/
e2e.bats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bats
@test "Mutate Namespace because Project has more labels" {
run kwctl run \
-r test_data/ns_without_labels.json \
--allow-context-aware \
--replay-host-capabilities-interactions test_data/session_project_found.yml \
annotated-policy.wasm
# this prints the output when one the checks below fails
echo "output = ${output}"
[ "$status" -eq 0 ]
[ $(expr "$output" : '.*"allowed":true.*') -ne 0 ]
[ $(expr "$output" : '.*JSONPatch.*') -ne 0 ]
}
@test "Does not mutate Namespace because Project has already all the labels" {
run kwctl run \
-r test_data/ns_with_labels.json \
--allow-context-aware \
--replay-host-capabilities-interactions test_data/session_project_found.yml \
annotated-policy.wasm
# this prints the output when one the checks below fails
echo "output = ${output}"
[ "$status" -eq 0 ]
[ $(expr "$output" : '.*"allowed":true.*') -ne 0 ]
[ $(expr "$output" : '.*JSONPatch.*') -eq 0 ]
}