Skip to content

Commit

Permalink
Integration test to verify controller pods status (kubernetes-sigs#811)
Browse files Browse the repository at this point in the history
The resources are verified by kubectl during apply,
but controller pods are unverified.

also invoke the new tests been adding under ./test/integration/
with this, we should expect the integration ci job automatically
pick up new test under ./test/integration
  • Loading branch information
figo authored and k8s-ci-robot committed Mar 8, 2019
1 parent d2aa1a2 commit a2f5862
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions scripts/ci-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ CRD_YAML="crd.yaml"
BOOTSTRAP_CLUSTER_NAME="clusterapi-bootstrap"
CONTROLLER_REPO="controller-ci" # use arbitrary repo name since we don't need to publish it
EXAMPLE_PROVIDER_REPO="example-provider-ci"
INTEGRATION_TEST_DIR="./test/integration"

install_kustomize() {
go get sigs.k8s.io/kustomize
Expand Down Expand Up @@ -67,12 +68,33 @@ delete_bootstrap() {
kind delete cluster --name "${BOOTSTRAP_CLUSTER_NAME}"
}

verify_cluster_api() {
echo "not implemented"
#TODO: verify cluster-api CRD on bootstrap cluster
wait_pod_running() {
retry=30
INTERVAL=6
until kubectl get pods "$1" -n "$2" --no-headers | awk -F" " '{s+=($3!="Running")} END {exit s}'
do
sleep ${INTERVAL};
retry=$((retry - 1))
if [ $retry -lt 0 ];
then
kubectl describe pod "$1" -n "$2"
kubectl logs "$1" -n "$2"
exit 1
fi;
kubectl get pods "$1" -n "$2" --no-headers;
done;
}

ensure_docker_in_docker() {
if [ -z "${PROW_JOB_ID}" ] ; then
# start docker service in setup other than Prow
service docker start
fi
# DinD is configured at Prow
}

main() {
ensure_docker_in_docker
build_containers

install_kustomize
Expand All @@ -81,9 +103,16 @@ main() {
install_kubectl
create_bootstrap

"${KUBECTL}" create -f "${CRD_YAML}"
"${KUBECTL}" create -f "${CRD_YAML}"

set +e
wait_pod_running "cluster-api-controller-manager-0" "cluster-api-system"
wait_pod_running "provider-controller-manager-0" "provider-system"
set -e

verify_cluster_api
if [ -d "${INTEGRATION_TEST_DIR}" ] ; then
go test -v "${INTEGRATION_TEST_DIR}"/...
fi

delete_bootstrap

Expand Down

0 comments on commit a2f5862

Please sign in to comment.