Skip to content

Commit

Permalink
Changing tests to use pod instead of port-forwarding. (open-policy-ag…
Browse files Browse the repository at this point in the history
…ent#861)

* Changing tests to use pod instead of port-forwarding.

Signed-off-by: luckoseabraham <luckose4u@gmail.com>

* Adding a dummy commit to test tests

Signed-off-by: luckoseabraham <luckose4u@gmail.com>

* Adding a dummy commit to test tests

Signed-off-by: luckoseabraham <luckose4u@gmail.com>

Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
  • Loading branch information
luckoseabraham and ritazh authored Sep 30, 2020
1 parent d247099 commit 09b042f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/bats/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ teardown() {
run wait_for_process $WAIT_TIME $SLEEP_TIME "get_ca_cert ${cert}"
assert_success

kubectl port-forward -n gatekeeper-system deployment/gatekeeper-controller-manager 8443:8443 &
FORWARDING_PID=$!
CLEAN_CMD="${CLEAN_CMD}; kill ${FORWARDING_PID}"
kubectl run temp --generator=run-pod/v1 --image=tutum/curl -- tail -f /dev/null
kubectl wait --for=condition=Ready --timeout=60s pod temp
kubectl cp ${cert} temp:/cacert

CLEAN_CMD="${CLEAN_CMD}; kubectl delete pod temp"

run wait_for_process $WAIT_TIME $SLEEP_TIME "curl -f -v --resolve gatekeeper-webhook-service.gatekeeper-system.svc:8443:127.0.0.1 --cacert ${cert} https://gatekeeper-webhook-service.gatekeeper-system.svc:8443/v1/admitlabel"
run wait_for_process $WAIT_TIME $SLEEP_TIME "kubectl exec -it temp -- curl -f --cacert /cacert --connect-timeout 1 --max-time 2 https://gatekeeper-webhook-service.gatekeeper-system.svc:443/v1/admitlabel"
assert_success
}


@test "constrainttemplates crd is established" {
wait_for_process $WAIT_TIME $SLEEP_TIME "kubectl -n gatekeeper-system wait --for condition=established --timeout=60s crd/constrainttemplates.templates.gatekeeper.sh"

Expand Down

0 comments on commit 09b042f

Please sign in to comment.