-
Notifications
You must be signed in to change notification settings - Fork 1
/
e2e.bats
29 lines (24 loc) · 1014 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
#!/usr/bin/env bats
@test "accept because Ingress host is unique" {
run kwctl run annotated-policy.wasm \
-r ./test_data/ingress.json \
--allow-context-aware \
--replay-host-capabilities-interactions ./test_data/k8s_ctx_no_duplicates.yml
# this prints the output when one the checks below fails
echo "output = ${output}"
# request accepted
[ "$status" -eq 0 ]
[ $(expr "$output" : '.*allowed.*true') -ne 0 ]
}
@test "reject because Ingress host is not unique" {
run kwctl run annotated-policy.wasm \
-r ./test_data/ingress.json \
--allow-context-aware \
--replay-host-capabilities-interactions ./test_data/k8s_ctx_duplicate.yml
# this prints the output when one the checks below fails
echo "output = ${output}"
# request rejected
[ "$status" -eq 0 ]
[ $(expr "$output" : '.*allowed.*false') -ne 0 ]
[ $(expr "$output" : '.*ingress host conflicts with an existing ingress <foo.bar.com>.*') -ne 0 ]
}