-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathe2e.bats
More file actions
24 lines (18 loc) · 768 Bytes
/
e2e.bats
File metadata and controls
24 lines (18 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bats
@test "accept because not a LoadBalancer service" {
run kwctl run -e gatekeeper annotated-policy.wasm -r test_data/service-clusterip.json
# 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 LoadBalancer services are not allowed" {
run kwctl run -e gatekeeper annotated-policy.wasm -r test_data/service_loadbalancer.json
# 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" : '.*Service of type LoadBalancer are not allowed.*') -ne 0 ]
}