-
Notifications
You must be signed in to change notification settings - Fork 1
/
e2e.bats
26 lines (20 loc) · 907 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
#!/usr/bin/env bats
@test "Accept service with no duplicated service selectors" {
run kwctl run --allow-context-aware \
-r test_data/service-admission-request.json \
--replay-host-capabilities-interactions test_data/replay-session-with-label-selector.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 ]
}
@test "Reject service with duplicated service selector" {
run kwctl run --allow-context-aware \
-r test_data/service-admission-request.json \
--replay-host-capabilities-interactions test_data/replay-session-service-with-app-selector.yml \
annotated-policy.wasm
[ "$status" -eq 0 ]
[ $(expr "$output" : '.*"allowed":false.*') -ne 0 ]
[ $(expr "$output" : '.*"message":"service is using selector(s) already defined by these services.*') -ne 0 ]
}