From: Srinivasan Date: Wed, 9 Dec 2020 12:55:02 +0000 (+0530) Subject: pods_all_edge X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=e45c0c77740765d2908191f23a30704d5839850c;p=ealt-edge.git pods_all_edge Signed-off-by: Srinivasan Change-Id: Ib8916eb11bedf0b11dff1853fcb7330bcec0e239 --- diff --git a/ci/daily build/csit/verifyClusterMep.sh b/ci/daily build/csit/verifyClusterMep.sh new file mode 100755 index 0000000..49afa8e --- /dev/null +++ b/ci/daily build/csit/verifyClusterMep.sh @@ -0,0 +1,106 @@ +#!/bin/bash -ex +############################################################################## +# Copyright (c) 2020 Huawei Tech and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +KUBERNETES=~/testk8s-kubernetes.yaml + +cat < "${KUBERNETES}" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kubernets-deployment + labels: + app: nginx +spec: + replicas: 1 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.15.12 + ports: + - containerPort: 80 + hostPort: 80 +EOF + +CLUSTER_INFO=$(kubectl cluster-info) + +count=0 +total=2 +result_nginx="failure" +result_pods="failure" + +if [[ $CLUSTER_INFO != "" ]]; then + kubectl create -f ~/testk8s-kubernetes.yaml + count=$((count+1)) +else + echo "No kubernetes cluster present" +fi + +sleep 20 + +echo "Kubectl deployments........................................." +kubectl get deployments + +echo "Test Case: Nginx-Deployment started" + +DEPLOY_CONDIT=$(kubectl get pods \ + --field-selector=status.phase==Running \ + | grep kubernets-deployment \ + | grep -c Running) + +if [[ $DEPLOY_CONDIT == 1 ]]; then + result_nginx="success"; + echo $result_nginx +fi + +echo "Kubectl pods in all namespaces................................." +kubectl get pods -A + +echo "-------------------------------------------------------------------" +echo "-------------------------------------------------------------------" + +sleep 20 + +echo "Test Case: Pods status check started" + +PODS_NOT_RUN_COUNT=$(kubectl get pods \ + --field-selector=status.phase!=Running \ + | grep -c STATUS) + +if [[ $PODS_NOT_RUN_COUNT > 0 ]]; then > /dev/null 2>&1 + result_pods="failure"; + count=$((count+1)) +else + count=$((count+1)) + result_pods="success"; + echo $result_pods +fi + + +echo "-------------------------------------------------------------------" +echo "| Total CSIT Tests: $count |" +echo "|-----------------------------------------------------------------|" +echo "| TEST CASE NAME | RESULT |" +echo "|-----------------------------------------------------------------|" +echo "| | |" +echo "| Nginx-Deployment | $result_nginx |" +echo "| | |" +echo "| Pods status check | $result_pods |" +echo "| | |" +echo "|-----------------------------------------------------------------|" +echo "| Executed Total CSIT Tests: $count |" +echo "-------------------------------------------------------------------"