-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathe2e.bats
68 lines (51 loc) · 1.89 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bats
@test "Reject because deprecated" {
run kwctl run \
--request-path test_data/ingress_creation.json \
--settings-json '{ "kubernetes_version" : "1.19.0", "deny_on_deprecation_default": true }' \
annotated-policy.wasm
# this prints the output when one the checks below fails
echo "output = ${output}"
[ "$status" -eq 0 ]
[ $(expr "$output" : '.*"allowed":false.*') -ne 0 ]
}
@test "By default deny_on_deprecation is enabled" {
run kwctl run \
--request-path test_data/ingress_creation.json \
--settings-json '{ "kubernetes_version" : "1.19.0" }' \
annotated-policy.wasm
# this prints the output when one the checks below fails
echo "output = ${output}"
[ "$status" -eq 0 ]
[ $(expr "$output" : '.*"allowed":false.*') -ne 0 ]
}
@test "Handle deny_on_deprecation set to false" {
run kwctl run \
--request-path test_data/ingress_creation.json \
--settings-json '{ "kubernetes_version" : "1.19.0", "deny_on_deprecation": false }' \
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 ]
}
@test "Reject because dropped" {
run kwctl run \
--request-path test_data/ingress_creation.json \
--settings-json '{ "kubernetes_version" : "1.25.0" }' \
annotated-policy.wasm
# this prints the output when one the checks below fails
echo "output = ${output}"
[ "$status" -eq 0 ]
[ $(expr "$output" : '.*"allowed":false.*') -ne 0 ]
}
@test "Accept on a really old version of kubernetes" {
run kwctl run \
--request-path test_data/ingress_creation.json \
--settings-json '{ "kubernetes_version" : "1.10.0" }' \
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 ]
}