Remove most of the time.Sleep from the e2e tests

This commit is contained in:
Manuel de Brito Fontes 2018-04-18 16:15:08 -03:00
parent c3ff76ae50
commit 62a80a39ad
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
30 changed files with 628 additions and 465 deletions

View file

@ -14,48 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
export JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "deploying NGINX Ingress controller"
cat deploy/namespace.yaml | kubectl apply -f -
cat deploy/default-backend.yaml | kubectl apply -f -
cat deploy/configmap.yaml | kubectl apply -f -
cat deploy/tcp-services-configmap.yaml | kubectl apply -f -
cat deploy/udp-services-configmap.yaml | kubectl apply -f -
cat deploy/without-rbac.yaml | kubectl apply -f -
cat deploy/provider/baremetal/service-nodeport.yaml | kubectl apply -f -
NAMESPACE=$1
echo "updating image..."
kubectl set image \
deployments \
--namespace ingress-nginx \
--selector app=ingress-nginx \
nginx-ingress-controller=quay.io/kubernetes-ingress-controller/nginx-ingress-controller:test
echo "deploying NGINX Ingress controller in namespace $NAMESPACE"
sleep 5
echo "waiting NGINX ingress pod..."
function waitForPod() {
until kubectl get pods -n ingress-nginx -l app=ingress-nginx -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True";
do
sleep 1;
done
}
export -f waitForPod
timeout 30s bash -c waitForPod
if kubectl get pods -n ingress-nginx -l app=ingress-nginx -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True";
then
echo "Kubernetes deployments started"
else
echo "Kubernetes deployments with issues:"
kubectl get pods -n ingress-nginx
echo "Reason:"
kubectl describe pods -n ingress-nginx
kubectl logs -n ingress-nginx -l app=ingress-nginx
exit 1
fi
cat $DIR/../manifests/ingress-controller/default-backend.yaml | kubectl create --namespace=$NAMESPACE -f -
cat $DIR/../manifests/ingress-controller/configmap.yaml | kubectl create --namespace=$NAMESPACE -f -
cat $DIR/../manifests/ingress-controller/tcp-services-configmap.yaml | kubectl create --namespace=$NAMESPACE -f -
cat $DIR/../manifests/ingress-controller/udp-services-configmap.yaml | kubectl create --namespace=$NAMESPACE -f -
cat $DIR/../manifests/ingress-controller/with-rbac.yaml | kubectl create --namespace=$NAMESPACE -f -
cat $DIR/../manifests/ingress-controller/service-nodeport.yaml | kubectl create --namespace=$NAMESPACE -f -